Welcome to Vanilla Breeze
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
Collapsible content panels with optional single-open mode, built on native <details> elements.
The <accordion-wc> component wraps a group of <details> elements to provide an accessible accordion interface with keyboard navigation and optional visual variants.
<accordion-wc> <details> <summary>What is Vanilla Breeze?</summary> <div> <p>Vanilla Breeze is a layered HTML component system...</p> </div> </details> <details> <summary>How does progressive enhancement work?</summary> <div> <p>Components work without JavaScript first...</p> </div> </details></accordion-wc>
| Attribute | Values | Default | Description |
|---|---|---|---|
single | boolean | — | Only allow one panel open at a time |
bordered | boolean | — | Add borders between panels |
flush | boolean | — | Remove outer border and padding |
compact | boolean | — | Reduce spacing |
indicator | "plus-minus", "none", "custom" | — | Expand/collapse indicator style |
transition | "fade", "slide", "scale" | — | Panel transition animation |
| Element | Required | Description |
|---|---|---|
<details> | yes | One per accordion panel — native disclosure element |
<summary> | yes | Panel heading inside each <details> |
Add single to allow only one panel to be open at a time. When a panel opens, any other open panel will close automatically.
This panel is open by default. Click another panel to see it close.
Opening this panel will automatically close the first one.
Only one panel can be open at a time in single mode.
<accordion-wc single> <details name="faq" open> <summary>First Panel</summary> <div><p>Content...</p></div> </details> <details name="faq"> <summary>Second Panel</summary> <div><p>Content...</p></div> </details></accordion-wc>
Add bordered to wrap the accordion in a border with dividers between items.
The bordered variant adds a container border and dividers between items.
Useful for forms, FAQs, and settings panels.
Borders help visually separate accordion items from surrounding content.
<accordion-wc bordered> <details> <summary>Bordered Style</summary> <div><p>Content...</p></div> </details> ...</accordion-wc>
Add compact for tighter spacing, useful in sidebars or when displaying many items.
Smaller padding for dense layouts.
Still fully accessible.
Great for navigation menus.
<accordion-wc compact> <details> <summary>Compact Item 1</summary> <div><p>Smaller padding...</p></div> </details> ...</accordion-wc>
Variants can be combined for different visual styles.
This is the answer to the first question.
This is the answer to the second question.
Content for item 1.
Content for item 2.
Settings options here.
More settings options.
Use indicator to change the open/close indicator. Four styles are available: chevron (default), plus-minus, custom, and none.
And rotates down when open. This is the default indicator style.
Most users expect this chevron pattern from accordions.
The plus sign transforms to a minus when open.
Plus-minus indicators are often used for expandable content.
Useful when you want a cleaner look or have custom indicators.
Click to expand and collapse as normal.
<!-- Default chevron (right/down) --><accordion-wc>...</accordion-wc> <!-- Plus-minus indicator --><accordion-wc indicator="plus-minus">...</accordion-wc> <!-- Custom indicators with arrows --><accordion-wc indicator="custom" style="--indicator-closed: '\\2192'; --indicator-open: '\\2193';"> ...</accordion-wc> <!-- Custom indicators with emoji --><accordion-wc indicator="custom" style="--indicator-closed: '\u{1F534}'; --indicator-open: '\u{1F7E2}';"> ...</accordion-wc> <!-- No indicator --><accordion-wc indicator="none">...</accordion-wc>
When focused on a panel header, the following keyboard shortcuts are available:
| Key | Action |
|---|---|
| ArrowDown | Move focus to the next panel header |
| ArrowUp | Move focus to the previous panel header |
| Home | Move focus to the first panel header |
| End | Move focus to the last panel header |
| Enter / Space | Toggle the focused panel (native behavior) |
The component dispatches events when panels are toggled.
| Event | Detail | Description |
|---|---|---|
accordion-wc:toggle |
{ index: number, open: boolean } |
Fired when a panel is opened or closed. |
const accordion = document.querySelector('accordion-wc'); accordion.addEventListener('accordion-wc:toggle', (event) => { const { index, open } = event.detail; console.log(`Panel ${index} is now ${open ? 'open' : 'closed'}`);});
The component exposes methods for programmatic control.
| Method | Parameters | Description |
|---|---|---|
open(index) |
index: number |
Open a specific panel by its 0-based index. |
close(index) |
index: number |
Close a specific panel by its 0-based index. |
toggle(index) |
index: number |
Toggle a specific panel open/closed. |
openAll() |
- | Open all panels (only works when not in single mode). |
closeAll() |
- | Close all panels. |
const accordion = document.querySelector('accordion-wc'); // Open the second panelaccordion.open(1); // Close the first panelaccordion.close(0); // Toggle the third panelaccordion.toggle(2); // Open all panels (not in single mode)accordion.openAll(); // Close all panelsaccordion.closeAll();
The component automatically applies ARIA attributes for accessibility:
aria-expanded on each summary indicates open/closed statearia-controls links summaries to their panelsaria-labelledby links panels back to their summariesrole="region" on panels for landmark navigationScreen readers will announce the expanded/collapsed state when panels are toggled. The keyboard navigation allows users to move between headers without expanding panels.
Focus remains on the summary element when toggling, and arrow key navigation moves focus between summaries without changing the open state.
Add transition to animate panel content when opening and closing using the View Transitions API. The content fade composes with the existing CSS ::details-content height animation — height animates via CSS, content appearance via VT.
| Value | Effect |
|---|---|
fade (default) | Crossfade panel content |
slide | Slide panel content in from the side |
scale | Scale panel content in/out |
The View Transition API animates the content appearance while native CSS handles the height. Both work together seamlessly.
Yes — combine transition with single for animated exclusive panels.
Animations are disabled when prefers-reduced-motion is active or data-motion-reduced is set on the root element.
A common use case for accordions is FAQ sections.
Install Vanilla Breeze via npm or include the CSS and JS files directly. Then start using the components in your HTML.
No! All components work without JavaScript using native HTML features. JavaScript enhances the experience with better keyboard navigation and ARIA support.
Yes, all components use CSS custom properties for easy theming. Override the variables in your stylesheet to match your brand.
Vanilla Breeze supports all modern browsers including Chrome, Firefox, Safari, and Edge. The progressive enhancement approach means older browsers still get a functional experience.