View laravel-hotwire on GitHub
1M
v0.91.0
Search 71 components and 72 controllers by name, category or description.
Accordion
Native disclosure accordion with single or multiple open items and disabled-item support
Single (default)
Only one item stays open at a time. Native details/summary under the hood.
What are the park opening hours?
Are pets allowed inside?
Is there an entrance fee?
Is there a parking lot?
Can I run a photo shoot on site?
<hw:accordion id="faq-single" value="hours">
@foreach ($faqs as $faq)
<hw:accordion.item :value="$faq->value">
<hw:accordion.trigger>{{ $faq->question }}</hw:accordion.trigger>
<hw:accordion.content>{{ $faq->answer }}</hw:accordion.content>
</hw:accordion.item>
@endforeach
</hw:accordion>
Items shortcut
Since 0.77: pass value/trigger/content descriptors through :items instead of composing each item.
What are the park opening hours?
Are pets allowed inside?
Is there an entrance fee?
Is there a parking lot?
Can I run a photo shoot on site?
@php($faqItems = $faqs->map(fn ($faq) => [
'value' => $faq->value,
'trigger' => $faq->question,
'content' => $faq->answer,
])->all())
<hw:accordion id="faq-items" value="hours" :items="$faqItems" />
Items plus composition
Generated items render before the slot. Compose an item when it needs custom markup, attributes or Stimulus bindings.
What are the park opening hours?
Are pets allowed inside?
Is there an entrance fee?
Is there a parking lot?
Can I run a photo shoot on site?
Still have a question?
@php($faqItems = $faqs->map(fn ($faq) => [
'value' => $faq->value,
'trigger' => $faq->question,
'content' => $faq->answer,
])->all())
{{-- Generated items render first; composed items follow. --}}
<hw:accordion id="faq-mixed" value="hours" :items="$faqItems">
<hw:accordion.item value="contact">
<hw:accordion.trigger :icon="false">
<span class="flex items-center gap-2">
<x-lucide-mail class="size-4 text-muted-foreground" />
Still have a question?
</span>
</hw:accordion.trigger>
<hw:accordion.content>Reach the team through the support channel.</hw:accordion.content>
</hw:accordion.item>
</hw:accordion>
Multiple
Allow more than one item open at once.
What are the park opening hours?
Are pets allowed inside?
Is there an entrance fee?
Is there a parking lot?
Can I run a photo shoot on site?
<hw:accordion id="faq-multiple" type="multiple" :value="['hours', 'tickets']">
@foreach ($faqs as $faq)
<hw:accordion.item :value="$faq->value">
<hw:accordion.trigger>{{ $faq->question }}</hw:accordion.trigger>
<hw:accordion.content>{{ $faq->answer }}</hw:accordion.content>
</hw:accordion.item>
@endforeach
</hw:accordion>
Disabled item
Prevented from toggling — aria-disabled="true" and keyboard/click ignored.
Basic settings
Enterprise-only settings
Danger zone
<hw:accordion id="faq-disabled">
<hw:accordion.item value="basic">
<hw:accordion.trigger>Basic settings</hw:accordion.trigger>
<hw:accordion.content>Anyone can update these.</hw:accordion.content>
</hw:accordion.item>
<hw:accordion.item value="enterprise" disabled>
<hw:accordion.trigger>Enterprise-only settings</hw:accordion.trigger>
<hw:accordion.content>This item cannot be opened.</hw:accordion.content>
</hw:accordion.item>
<hw:accordion.item value="danger">
<hw:accordion.trigger>Danger zone</hw:accordion.trigger>
<hw:accordion.content>Destructive actions live here.</hw:accordion.content>
</hw:accordion.item>
</hw:accordion>
Without chevron
Hide the trailing icon on any trigger.
Custom trigger, no chevron
<hw:accordion id="faq-no-icon">
<hw:accordion.item value="a">
<hw:accordion.trigger :icon="false">
<span class="flex items-center gap-2">
<x-lucide-bookmark class="size-4 text-muted-foreground" />
Custom trigger, no chevron
</span>
</hw:accordion.trigger>
<hw:accordion.content>You can compose the trigger content freely.</hw:accordion.content>
</hw:accordion.item>
</hw:accordion>