Skip to content
Alpha

Hololink UI is under active development. Components, APIs and these docs may change without notice.

Holo Accordion & Accordion Item

<holo-accordion> manages a set of <holo-accordion-item> children, each with a header button (aria-expanded, aria-controls) and a content region (role="region", aria-labelledby). By default only one item can be expanded at a time; set multiple to allow several items open at once.

Use it for:

  • Grouping long content into labelled sections that readers expand one at a time, such as FAQs or settings groups.
  • Hiding secondary detail while keeping every section heading visible.

Don’t use it for:

  • A single standalone disclosure. Use Details instead.
  • Switching between peer views of the same content. Use Tabs.
  • Content that every reader needs to see. Show it directly.

Free shipping on orders over $50.

Returns accepted within 30 days.

Two-year limited warranty included.

<holo-accordion>
<holo-accordion-item value="shipping" heading="Shipping" expanded> Free shipping on orders over $50. </holo-accordion-item>
<holo-accordion-item value="returns" heading="Returns"> Returns accepted within 30 days. </holo-accordion-item>
</holo-accordion>

Free shipping on orders over $50.

Returns accepted within 30 days.

<holo-accordion multiple>
<holo-accordion-item value="shipping" heading="Shipping" expanded> Free shipping on orders over $50. </holo-accordion-item>
<holo-accordion-item value="returns" heading="Returns" expanded> Returns accepted within 30 days. </holo-accordion-item>
</holo-accordion>

Each <holo-accordion-item> renders an <h3> containing a native <button type="button"> with aria-expanded and aria-controls. The panel is a role="region" labelled by that button through aria-labelledby, and is hidden while collapsed. The trigger is named by the heading prop or the heading slot.

Key Action
Tab Moves focus to the next header button (or other focusable content)
Enter, Space Expands or collapses the focused item
  • Every header button is a normal tab stop. There is no arrow-key navigation between headers.
  • A disabled item uses the native disabled attribute, so it leaves the tab order.
  • Focus stays on the header button when a panel opens or closes. A visible focus ring is drawn on the button with :focus-visible.

You provide:

  • A meaningful heading for every item. The heading level is fixed at h3, so check it fits your page outline.
  • Panel content that makes sense on its own, since collapsed panels are hidden and not exposed to assistive technology.

Importing

import '@philbob-sideprojects/hololink-ui/holo-accordion';

Properties

PropertyAttributeTypeDefaultDescription
multiplemultiplebooleanfalseIf true, multiple holo-accordion-item children may be expanded at once. Defaults to false (single-open / mutually-exclusive expansion).

Events

EventDetailDescription
holoAccordionToggleHoloAccordionToggleDetailEmitted whenever a child holo-accordion-item is expanded or collapsed by the user. detail is { value: string; expanded: boolean }, where value is the item's value (or its generated id).

Slots

SlotDescription
(default)The holo-accordion-item elements to group.

CSS custom properties

PropertyDescription
--holo-accordion-border-colorColor of the border above the first item.

Importing

import '@philbob-sideprojects/hololink-ui/holo-accordion-item';

Properties

PropertyAttributeTypeDefaultDescription
disableddisabledbooleanfalseIf true, this item's header is disabled and non-interactive.
expandedexpandedbooleanfalseWhether this item's content region is expanded. Managed by the parent holo-accordion when it enforces single-open behavior.
headingheadingstring—The text label rendered in the header button. Use the "heading" slot instead for richer markup.
valuevaluestring—An identifier for this item, reported in holoAccordionToggle events. Defaults to an auto-generated id if omitted.

Events

EventDetailDescription
holoAccordionItemToggleHoloAccordionToggleDetailEmitted (bubbles + composed) when the user toggles this item's header. detail is { value: string; expanded: boolean }. The parent holo-accordion listens for it to enforce single-open behavior and re-emits it as holoAccordionToggle.

Slots

SlotDescription
(default)The content revealed when the item is expanded.
headingRich header content. Replaces the heading text when provided.

CSS custom properties

PropertyDescription
--holo-accordion-border-colorColor of the divider below the item.
--holo-accordion-text-colorText color of the header button.