Compact, non-modal site settings panel with a gear trigger and accordion sections: appearance, accessibility, layout, effects, system, and environment on pages that use the ambient pack.
Overview
A compact settings panel opened from a gear button. It is built from native <details> sections that share a per-instance name, so only one section is open at a time. The sections hold theme selection, accessibility toggles, layout options, effects, system information and, on pages that use the ambient pack, its opt-out.
It runs alongside <theme-picker>, which covers only color mode and theme. Both components read and write the same ThemeManager state and listen for vb:theme-change, so a mode or theme picked in one shows up in the other on the same page. Everything else (accessibility themes, layout, effects, the ambient opt-out) is set here. Other tabs are not synced: there is no storage listener, so a second tab picks up changes when it reloads.
1
<settings-panel></settings-panel>
Attributes
| Attribute |
Type |
Default |
Description |
open |
boolean |
— |
Reflected state, set by open(), close() and toggle(). Don't author it. |
data-label-* |
string |
English |
Overrides for every visible or announced string. See Labels. |
Child attributes
| Attribute |
On |
Description |
data-trigger |
<button> |
Marks your own trigger. Without one, the first child <button> is used, and if there is none, a gear button is generated. The runtime sets aria-haspopup="dialog", aria-expanded and aria-controls on the trigger. |
Panel Sections
The panel has six collapsible <details> sections. Only one is open at a time, and Appearance starts open.
Appearance
- Color Mode — segmented control: Auto, Light or Dark (
ThemeManager.setMode).
- Theme — a
<select> grouped with <optgroup> from the shared theme list (ThemeManager.setBrand). Active accessibility themes are re-applied on top of the new theme.
Accessibility
Toggle switches (input[data-switch="s"]) that add the theme to <html data-theme> after the brand theme:
- High Contrast (
a11y-high-contrast)
- Large Text (
a11y-large-text)
- Dyslexia-Friendly (
a11y-dyslexia)
The section also has a Single-Key Shortcuts switch (WCAG 2.1.4 Character Key Shortcuts). Turning it off sets <html data-char-shortcuts="off"> and stores charShortcuts: false in vb:settings:extensions. Every unscoped single-character shortcut then stops firing: data-hotkey actions such as /, the ? key of <short-cuts>, and any component that binds shortcuts through VB's hotkey binder. Shortcuts with Ctrl, Cmd or Alt keep working. The stored choice is restored as soon as the hotkey code loads. With no stored choice, an authored data-char-shortcuts="off" on <html> is the starting state.
Layout
- Fluid Scaling — on or off. When it's off, static token values are used.
- Density — Compact, Default or Spacious. Shown only when fluid scaling is on.
- Canvas Backdrop — on or off. When it's on, these controls also appear:
- Style — Default, Flush or Elevated.
- Chrome — Card, Stretch or Integrated.
- Fixed Header — adds
fixed to the backdrop chrome value.
- Page Background — Theme Default, Solid Color (one color input) or Gradient (start color, end color and a direction
<select>).
- Sticky Navigation — toggles
<html data-sticky> and starts or stops the sticky manager. The panel touches only the root attribute. The sticky manager owns the banner header's data-sticky: it adds the attribute only when it's missing and removes only what it added. A header you wrote data-sticky on yourself is never changed.
Effects
- Motion Effects (default on). Turning it off sets
<html data-motion-reduced>.
- Sound Effects (default off). The sound manager is loaded only when this is turned on.
Environment
- Ambient Styling (default on)
This section appears only on a page that opts in to the ambient pack with <html data-ambient="…">. The switch is the visitor's opt-out: turning it off stores the choice in localStorage and removes the season, daypart, weather and occasion state from the page. The panel does not load the pack; it sets the preference the pack reads.
System
- The Vanilla Breeze version.
- The service-worker status, in a
role="status" line.
- Clear Cache and Check for Updates buttons. Their results are announced through a polite live region.
The Reset to Defaults button in the footer asks for confirmation inside the panel, with Reset and Cancel buttons; there is no browser confirm(). Confirming resets ThemeManager, clears the accessibility, effects and sticky preferences, and clears an ambient opt-out. Sticky navigation goes back to the page's authored state. The reset is announced.
Custom Trigger
Provide your own trigger button as a child element with data-trigger. If no trigger is found, a gear icon is generated.
123456
<settings-panel> <button type="button" data-trigger> <icon-wc name="settings" label="Settings"></icon-wc> Settings </button></settings-panel>
Footer Integration
The usual place for the panel is next to the footer's legal links. The panel opens upward from the trigger, and downward when there isn't room above.
123456789
<footer> <site-legal> <span>© 2026 Your Name</span> <a href="/about">About</a> </site-legal> <site-tools> <settings-panel></settings-panel> </site-tools></footer>
Labels
Every string the panel renders or announces can be overridden with data-label-<key> on the element. Values are inserted as text, not as HTML. {n} in data-label-sw-active is replaced with the number of cached files. An authored trigger keeps its own accessible name; data-label-trigger applies only to the generated gear.
12345678910
<settings-panel lang="es" data-label-trigger="Ajustes del sitio" data-label-dialog="Ajustes del sitio" data-label-title="Ajustes" data-label-close="Cerrar ajustes" data-label-appearance="Apariencia" data-label-reset="Restablecer" data-label-reset-confirm="¿Restablecer todos los ajustes?" data-label-reset-yes="Restablecer" data-label-reset-cancel="Cancelar"></settings-panel>
| Attribute |
Default |
data-label-trigger | Site settings |
data-label-dialog | Site settings |
data-label-title | Settings |
data-label-close | Close settings |
data-label-appearance | Appearance |
data-label-color-mode | Color mode |
data-label-mode-auto | Auto |
data-label-mode-light | Light |
data-label-mode-dark | Dark |
data-label-theme | Theme |
data-label-accessibility | Accessibility |
data-label-high-contrast | High Contrast |
data-label-large-text | Large Text |
data-label-dyslexia | Dyslexia-Friendly |
data-label-char-shortcuts | Single-Key Shortcuts |
data-label-layout | Layout |
data-label-fluid | Fluid Scaling |
data-label-density | Density |
data-label-density-compact | Compact |
data-label-density-default | Default |
data-label-density-spacious | Spacious |
data-label-backdrop | Canvas Backdrop |
data-label-backdrop-style | Style |
data-label-backdrop-default | Default |
data-label-backdrop-flush | Flush |
data-label-backdrop-elevated | Elevated |
data-label-chrome | Chrome |
data-label-chrome-card | Card |
data-label-chrome-stretch | Stretch |
data-label-chrome-integrated | Integrated |
data-label-fixed-header | Fixed Header |
data-label-page-bg | Page Background |
data-label-page-bg-default | Theme Default |
data-label-page-bg-color | Solid Color |
data-label-page-bg-gradient | Gradient |
data-label-bg-color | Color |
data-label-grad-start | Start |
data-label-grad-end | End |
data-label-grad-direction | Direction |
data-label-dir-to-bottom | Top → Bottom |
data-label-dir-to-right | Left → Right |
data-label-dir-135deg | Diagonal ↘ |
data-label-dir-45deg | Diagonal ↗ |
data-label-sticky | Sticky Navigation |
data-label-effects | Effects |
data-label-motion | Motion Effects |
data-label-sounds | Sound Effects |
data-label-environment | Environment |
data-label-ambient | Ambient Styling |
data-label-system | System |
data-label-sw-label | Service Worker: |
data-label-sw-checking | checking… |
data-label-sw-unsupported | Not supported |
data-label-sw-active | Active ({n} cached files) |
data-label-sw-unregistered | Not registered |
data-label-clear-cache | Clear Cache |
data-label-clearing | Clearing… |
data-label-cleared | Cache cleared |
data-label-check-update | Check for Updates |
data-label-checking | Checking… |
data-label-update-available | Update available |
data-label-up-to-date | Up to date |
data-label-failed | Failed |
data-label-reset | Reset to Defaults |
data-label-reset-confirm | Reset all settings to defaults? |
data-label-reset-yes | Reset |
data-label-reset-cancel | Cancel |
data-label-reset-done | Settings reset to defaults |
JavaScript API
| Member |
Type |
Description |
open() |
method |
Opens the panel and moves focus into it. If the element hasn't rendered yet (it isn't connected), the call is queued until it renders. |
close() |
method |
Closes the panel. If focus is inside the panel it returns to the trigger; focus that is elsewhere is not moved. |
toggle() |
method |
Opens the panel if it's closed and closes it if it's open. |
data |
property |
{ a11yThemes, extensions: { motionFx, sounds, charShortcuts }, sticky }. Setting it applies each field you provide to the page straight away, writes it to VBStore and updates the controls. It works before the panel renders. |
12345678910
const settings = document.querySelector('settings-panel'); settings.open();settings.close(); settings.data = { a11yThemes: ['a11y-large-text'], sticky: true };settings.addEventListener('settings-panel:data-changed', (e) => { console.log(e.detail.data); });
Events
| Event |
Target |
Detail |
settings-panel:upgraded |
host |
— |
settings-panel:data-changed |
host |
{ data, source: 'property' }, fired after the data setter's writes finish |
vb:a11y-themes-change |
window |
string[] of active accessibility themes |
vb:extensions-change |
window |
{ motionFx, sounds, charShortcuts } |
State Sharing
<settings-panel> shares state through these channels. <theme-picker> uses the first (mode and theme); a second panel, or your own controls, can use all three. When a window event arrives, the panel applies the event's detail before it updates its controls. That way it never shows stale values, and it never writes stale values back.
| Channel |
localStorage key |
Window event |
| Theme (mode, brand, fluid, backdrop, page background) |
vb:theme:current (ThemeManager) |
vb:theme-change |
| Accessibility themes |
vb:settings:a11y |
vb:a11y-themes-change |
| Effects and shortcuts (motion, sound, single-key shortcuts) |
vb:settings:extensions ({ motionFx, sounds, charShortcuts }) |
vb:extensions-change |
| Sticky navigation |
vb:settings:sticky ("on" / "off") |
— |
The VBStore values are wrapped in a { data, timestamp } envelope. The site's head script restores a stored sticky "on" before first paint.
Keyboard Navigation
| Key |
Action |
| Enter / Space on the trigger |
Open the panel and move focus into it |
| Tab / Shift+Tab |
Move through the controls. Tabbing out of the panel closes it. |
| Escape |
With focus on the trigger or inside the panel: close the panel and return focus to the trigger |
Accessibility
- The panel is a non-modal
role="dialog", named by data-label-dialog (default "Site settings"). When it opens, focus moves to the panel. It does not trap focus, because the page behind it stays usable: tabbing out, clicking outside or pressing Escape (with focus on the trigger or in the panel) closes it. Whenever it closes while focus is inside it, focus returns to the trigger, so focus is never left on a hidden control.
- The trigger has
aria-haspopup="dialog", aria-controls and an aria-expanded that tracks the open state, including across a remove and reinsert.
- Color mode, density, backdrop style and chrome are radio groups inside
<fieldset> elements with visually hidden <legend>s. Their radio names and the control ids carry a per-instance suffix, so two panels on one page don't share groups or labels.
- Toggle switches are native
<input type="checkbox" data-switch="s"> elements inside their <label>.
- The service-worker status line is
role="status". Clear Cache, Check for Updates and Reset results are announced through a visually hidden live region.
- Reset asks for confirmation inside the panel and moves focus to Cancel.