Data display

Accordion

A stack of collapsible sections. Each item has a header button that shows or hides its panel; with exclusive, opening one closes the others.

An item with a label renders its own heading and content, so the two inner tags are only written for a custom header.

Your invoices are issued on the first day of each month.
Orders leave the warehouse within two business days.
Blade

Billing starts open and Shipping closed. Each header toggles its own panel, and both can be open at once.

One open at a time, bound to Livewire #

Opening Shipping closes Billing and sets $section to 'shipping'; closing it sets null. Setting the property on the server opens that item. Without exclusive the property is an array of the open names, e.g. ['billing', 'shipping'].

Your invoices are issued on the first day of each month.
Orders leave the warehouse within two business days.
$section:
Blade

Rendering from data #

Yes. Upgrades apply right away and downgrades at the end of the billing period.
Annual plans can be refunded within 30 days of purchase.
Every database is backed up daily and kept for 14 days.
Blade

Custom header #

Without label, the item renders its slot as is: the heading takes any markup, here a badge next to the title, and the whole header stays clickable.

Your invoices are issued on the first day of each month.
Blade

Border and sizes #

border draws a frame around the accordion (solid, dashed or dotted) and size sets padding, font size and radius.

Compact spacing for dense panels.
More content.
Roomier spacing for top-level sections.
More content.
Blade

Reversed and disabled #

reversed puts the chevron before the label; disabled on an item (or on the accordion) blocks its header.

Create a project and invite your team.
Available on the Enterprise plan.
Generate tokens in your account settings.
Blade

Several open, bound #

Without exclusive, the bound property is an array of the open names.

Name, email and language.
Members and roles.
Plan and invoices.
Open:
Blade

Events #

Items fire opened and closed; the accordion fires changed with the item elements in $event.detail.items. Listen on the tag itself.

Your recent orders.
Your customers.
Open items: · Last event:
Blade

Nested #

An accordion inside an item; it inherits the props set on the item that holds it.

Site name and timezone.
Cache and webhooks.
Connected apps.
Blade

Customization #

trigger: attributes go to the header button and content: to the panel; collapse takes x-collapse modifiers.

Your invoices are issued on the first day of each month.
Blade

Reference

tk:accordion
└── tk:accordion.item
    ├── tk:accordion.heading
    └── tk:accordion.content

tk:accordion

Prop Type Default Description
exclusive bool false Only one item stays open; opening another closes it.
collapse bool | string true Animates opening and closing. false turns the animation off; a string is passed as x-collapse modifiers (e.g. duration.500ms).
reversed bool false Puts the chevron before the label instead of after it.
size string md xs, sm, md, lg, xl, 2xl or 3xl. Sets padding, font size and corner radius.
border bool | string null Draws a border around the accordion and pads the items. true, solid, dashed or dotted.
disabled bool false Disables every header.
level int | false 2 Heading level announced for each header (aria-level). false drops the heading wrapper.
region bool true false drops role="region" from the panels.

wire:model and x-model bind the open item names: one name with exclusive, an array of names otherwise.

Slots

Slot Description
default The items.

Events

Event Detail When
changed { items }, the item elements An item of this accordion opened or closed.

tk:accordion.item

Prop Type Default Description
label string | slot null Header text. When given, the item renders its own heading and content, and the default slot is the panel body. Without it, the default slot is rendered as is.
name string null Identifies the item in the accordion's wire:model / x-model value.
expanded bool false Opens the item on the first render.
disabled bool false Disables this item's header.

size, collapse, reversed, border, level and region are inherited from the accordion and can be set per item.

Slots

Slot Description
default The panel body, or the heading and content when label is not given.

Events

Event Detail When
opened The item was opened.
closed The item was closed.

Prefixes

Prefix Goes to
trigger: The header button.
content: The panel.

tk:accordion.heading and tk:accordion.content

Used inside an item without label. The heading takes label (or its slot), size, collapse, reversed, border, disabled and level; the content takes size, collapse, border and region. All are inherited from the item and the accordion.

Slots

Slot Description
default The header content, in place of label.
default The panel body.

Events

Events are dispatched on the component's own element and do not bubble: listen on the tag itself.

With Alpine:

blade

Calling a Livewire action:

blade

Customization

Classes and attributes on a tag go to its root element. To reach an inner element of an item, prefix the attribute (listed in the Reference above).

blade

Accessibility

Follows the WAI-ARIA accordion pattern. Each header is a <button> inside an element with role="heading" and aria-level, carrying aria-expanded and aria-controls pointing to its panel. Each panel has role="region" labelled by its header; set :region="false" above six items, where that many landmarks become noise for screen readers.

Key Action
Enter, Space Opens or closes the focused header's panel.
Arrow Down / Arrow Up Moves focus to the next / previous header, wrapping around.
Home / End Moves focus to the first / last header.
Tab Moves through the headers and the focusable content of open panels.

Disabled headers are skipped by the arrow keys, Home and End.

Behavior notes

  • expanded only sets the initial state: after the first render the browser owns it, so a Livewire update never closes an item the user opened. To drive it from the server, give each item a name and bind the accordion with wire:model / x-model.
  • When the accordion is bound with wire:model / x-model, the bound value decides which items are open and expanded is ignored.
  • A value coming from wire:model / x-model on page load is applied without animation and without firing opened / changed.
  • With exclusive, if several items are marked expanded, only the first stays open.
  • A nested accordion inherits the props set on the item that holds it (disabled, reversed, border, level, collapse, region, size). To reset one, pass it on the nested accordion (e.g. :disabled="false").