Skip to content
UI Brok

Loading…

No results

Browse catalog

Accordion

Stacked disclosure panels with single or multiple open modes and arrow-key navigation.

Preview

Yes. It follows the WAI-ARIA disclosure pattern with aria-expanded and full keyboard support.

Yes, with a reduced-motion-safe transition. Motion is skipped when the user prefers reduced motion.

Pass :multiple="true" to the accordion root to allow several panels open at once.

Controls

Disabled
Theme
Surface
Direction
Viewport

Device view renders in an isolated frame so real responsive breakpoints apply. Switch to Full for overflowing popovers.

Installation

terminal
php artisan ui:add accordion

Behavior layer (Alpine)

This component installs a self-registering Alpine module to resources/js/ui/accordion.js. Import the behavior layer once from your bundle so it loads (it hooks alpine:init):

resources/js/ui/index.js JS
import './accordion.js';

Registry contract

Install confidence

php artisan ui:add accordion writes only the generated targets below. The CLI validates each file hash before writing and prompts before replacing local changes unless --force is used.

Version
1.2.0
License
open
Stability
stable
Contract
v2
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/components/ui/accordion.blade.php
blade resources/views/components/ui/accordion/item.blade.php
blade resources/views/components/ui/accordion/trigger.blade.php
blade resources/views/components/ui/accordion/content.blade.php
js resources/js/ui/accordion.js

Registry dependencies

None.

Package dependencies

composer: jml/brok:^1.0

npm: alpinejs

Guidance

Progressive disclosure

Reveal optional or secondary content on demand.

Use when

  • Use for secondary or optional content, especially when users usually inspect one short section at a time. Do not hide required workflow content or comparison-heavy information because disclosure controls reduce visibility and increase interaction cost.

Avoid when

  • Best for many short secondary sections. It reduces visibility and adds interaction cost, so keep required workflow content visible.
Task length
short
Interaction cost
medium
Interruptiveness
none
Input precision
none
Mobile / touch risk
medium
Accessibility risk
high
Needs background context
No
Comparison needed
No

Preferred alternatives

  • Visible sections
  • Tabs for a few long peer sections

Anti-patterns

  • Hiding required workflow content
  • Using accordions for cross-section comparison

API

manifest knowledge + registry-derived coverage

Props

Prop Type / values Default Description
type single|multiple single Whether one or many items can be open.
disabled false|true false Documented catalog control used by the preview workbench.
multiple bool false Declared by @props in the registry Blade source.
default mixed|null null Declared by @props in the registry Blade source.
variant string default Declared by @props in the registry Blade source.
indicator string chevron Declared by @props in the registry Blade source.
chevronSide string end Declared by @props in the registry Blade source.
value mixed required Declared by @props in the registry Blade source.
subtitle mixed|null null Declared by @props in the registry Blade source.
icon mixed|null null Declared by @props in the registry Blade source.

Slots

  • default — Accordion item, trigger, and content subcomponents.
  • x-ui.accordion.item — Installed subcomponent from the registry item.
  • x-ui.accordion.trigger — Installed subcomponent from the registry item.
  • x-ui.accordion.content — Installed subcomponent from the registry item.

Data slots

accordion accordion-content accordion-heading accordion-item accordion-subtitle accordion-trigger accordion-trigger-icon

Capabilities

wcag-2.2-aa-target interactive responsive rtl darkMode localized

Behavior

  • Uses server-rendered Blade and semantic HTML.
  • Keyboard-accessible disclosure groups with stable item values.
  • Installs a JavaScript behavior module when the registry item includes resources/js/ui files.
  • Declares registry capability flags: a11y, interactive, responsive, rtl, darkMode, localized.

Usage

previews.components.accordion.default.blade.php Blade
<x-ui.accordion class="w-full max-w-md">
    <x-ui.accordion.item value="item-1">
        <x-ui.accordion.trigger>{{ __('Is it accessible?') }}</x-ui.accordion.trigger>
        <x-ui.accordion.content>{{ __('Yes. It follows the WAI-ARIA disclosure pattern with aria-expanded and full keyboard support.') }}</x-ui.accordion.content>
    </x-ui.accordion.item>
    <x-ui.accordion.item value="item-2">
        <x-ui.accordion.trigger>{{ __('Is it animated?') }}</x-ui.accordion.trigger>
        <x-ui.accordion.content>{{ __('Yes, with a reduced-motion-safe transition. Motion is skipped when the user prefers reduced motion.') }}</x-ui.accordion.content>
    </x-ui.accordion.item>
    <x-ui.accordion.item value="item-3">
        <x-ui.accordion.trigger>{{ __('Can multiple panels open?') }}</x-ui.accordion.trigger>
        <x-ui.accordion.content>{{ __('Pass :multiple="true" to the accordion root to allow several panels open at once.') }}</x-ui.accordion.content>
    </x-ui.accordion.item>
</x-ui.accordion>

Variants

Free shipping on orders over $50. Most orders ship within two business days.

Return any item within 30 days. Open this while the panel above stays open — multiple panels coexist.

Every product carries a one-year limited warranty against manufacturing defects.
previews.components.accordion.variants.blade.php Blade
{{-- Multiple open mode (abui "Accordion Multiselect"): pass :multiple="true"
     so several panels can stay open at once. `default` opens one initially. --}}
<x-ui.accordion :multiple="true" default="item-1" class="w-full max-w-md">
    <x-ui.accordion.item value="item-1">
        <x-ui.accordion.trigger>{{ __('Shipping') }}</x-ui.accordion.trigger>
        <x-ui.accordion.content>{{ __('Free shipping on orders over $50. Most orders ship within two business days.') }}</x-ui.accordion.content>
    </x-ui.accordion.item>
    <x-ui.accordion.item value="item-2">
        <x-ui.accordion.trigger>{{ __('Returns') }}</x-ui.accordion.trigger>
        <x-ui.accordion.content>{{ __('Return any item within 30 days. Open this while the panel above stays open — multiple panels coexist.') }}</x-ui.accordion.content>
    </x-ui.accordion.item>
    <x-ui.accordion.item value="item-3">
        <x-ui.accordion.trigger>{{ __('Warranty') }}</x-ui.accordion.trigger>
        <x-ui.accordion.content>{{ __('Every product carries a one-year limited warranty against manufacturing defects.') }}</x-ui.accordion.content>
    </x-ui.accordion.item>
</x-ui.accordion>

Accessibility & localization

WCAG 2.2 AA RTL-ready data-slot Keyboard focus-visible Localized labels
  • Accessibility target: wcag-2.2-aa-target.
  • Uses semantic HTML and a stable data-slot attribute for styling/scripting hooks.
  • Focus-visible rings use the ring token so keyboard focus is always visible.
  • Disabled and invalid states are conveyed to assistive tech, not by color alone.
  • Targets WCAG 2.2 AA; verify contrast in light, dark, admin and customer surfaces above.
  • Labels go through __() and the component uses logical properties (ms-*, text-start, start-*) so it mirrors correctly — flip the preview to RTL to confirm.

Source

The exact, editable file ui:add writes into your app — copy it or own the whole thing. Previews render this same code; there are no preview-only components.

Changelog

Current version: v1.2.0. See the site changelog for the full release history.