Display accordion
All controllers

Accordion Controller

Coordinates native <details> / <summary> accordion items without replacing browser disclosure behavior.

Identifier: accordion Loaded by: auto-loaded after php artisan hotwire:install; publish only to customize with php artisan hotwire:controllers accordion.

Markup

HTML
<section data-controller="accordion" data-accordion-type-value="single">
    <details data-accordion-target="item" data-value="shipping" open>
        <summary>Shipping</summary>
        <section>Shipping answers.</section>
    </details>
    <details data-accordion-target="item" data-value="billing">
        <summary>Billing</summary>
        <section>Billing answers.</section>
    </details>
</section>

Values

Value Type Default Description
type String single Use multiple to allow more than one item open.
value String "" Initial open value. Pass a JSON array for multiple values.

Behavior

  • single closes sibling items when a new item opens.
  • multiple leaves sibling items open.
  • An item with data-accordion-open-override="true|false" keeps that explicit initial state when the root value is applied. In single mode, an explicitly open item takes precedence over root-value matches.
  • Initial state reconciliation is silent; accordion:change is dispatched only for subsequent toggles.
  • Items with aria-disabled="true" or data-disabled="true" cannot be opened.
  • The controller dispatches accordion:change after an item toggles.

The event detail is:

JS
{
    value: "shipping",
    open: true,
    item: detailsElement,
}

Accessibility

The controller relies on native <details> / <summary> semantics. It does not implement roving tabindex or arrow-key navigation. Native Tab, Enter and Space behavior stays intact.