Collapsible
A standalone disclosure: one trigger that shows and hides one region of content. It is the bare WAI-ARIA Disclosure pattern with no surrounding chrome.
- Collapsible (this component) — a single independent show/hide: a "read more", an advanced-options panel. Stack several for loosely-related toggles that need no coordination and no card chrome.
- Accordion — a coordinated group of panels with optional single-open behavior and card chrome. Reach for it when opening one panel should be able to close the others.
- FAQ — an accordion specialized for questions that also emits FAQPage structured data derived from what it renders. Use it for a real question list.
- Reveal — for scroll- or load-triggered entrance animation, not a user toggle.
Basic Usage
The default slot is the collapsible content; trigger is the clickable label.
Collapsible is block-level — it fills its container's width, and that width does not change as it opens or closes (watch the previews below stay put; in your app it spans whatever column you place it in).
We offer a 30-day money-back guarantee on all plans, no questions asked.
Open by Default
Pass :open="true" to render the region expanded on first paint.
Orders ship within 2 business days. Tracking is emailed once your parcel leaves the warehouse.
Rich Trigger
For a trigger that needs an icon or markup, use a <x-slot:trigger> instead of the string prop.
The slot renders inside a <button>, which takes text-level content only, so a layout primitive
in it renders as a span, as as="span" does below.
In Context — an FAQ
The most common use: a stack of independent disclosures. Width stays put as items open and close.
Yes — upgrade or downgrade anytime from Billing. Changes are prorated to the day.
Every paid plan includes unlimited seats. Invite teammates from Settings → Members.
Export everything to CSV or JSON at any time — your data is never locked in.
Find in Page
Collapsed content stays findable by the browser's own search. When a match lands inside it, the browser expands the region, scrolls to it and highlights the text, and the trigger reports it as expanded. Until then the content is out of sight, out of the tab order and hidden from screen readers.
Turn it off for a spoiler, or any content that must stay closed until someone opens it:
<x-wirekit::collapsible trigger="Show the ending" :findable="false">
It was the butler.
</x-wirekit::collapsible>
This is a progressive enhancement. It works in browsers that support hidden="until-found"; in the rest, collapsed content is hidden entirely and the browser search does not look inside it.
Collapsed, the region keeps its box. get reports it as visible while the screen is drawn correctly — so a test that decides "is it open?" from geometry reads every collapsed region as open, and so does anything you style off its size. Read the hidden attribute, never the geometry, and keep padding and borders on the element inside the region. The accordion page explains it at length.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
trigger |
string|null | null |
The trigger label. For rich content, use a <x-slot:trigger> instead. |
open |
bool | false |
Whether the region starts expanded |
findable |
bool | true |
Let the browser's find in page search collapsed content and expand the region a match lands in. See Find in Page |
scope |
string|null | null |
Scoped personalization name |
Accessibility
- An
aria-labeloraria-labelledbyof yours makes the collapsible agroupnamed by it. - The trigger is a native
<button>, so it is keyboard-focusable and operable out of the box. - On a coarse pointer, and inside an element with
data-wk-touch, the trigger takes the 44px height every button takes there, across its whole width. aria-expandedreflects the open/closed state;aria-controlslinks the trigger to the region it toggles.- The chevron is decorative (
aria-hidden="true"). - The region animates open/closed via Alpine's
x-collapse, which respectsprefers-reduced-motion.
Keyboard Interaction
| Key | Action |
|---|---|
Tab |
Move focus to the trigger |
Enter / Space |
Toggle the region open or closed |
Design Tokens
| Token | Used for |
|---|---|
--color-wk-text |
Trigger + content text |
--color-wk-ring |
Trigger focus ring |
--radius-wk-sm |
Trigger focus-ring corner radius |
--transition-wk-duration |
Chevron rotation and expand / collapse timing |
--padding-wk-y-lg |
Gap between trigger and content |
Config Defaults
The defaults live in config/ under components.. Override them globally:
'components' => [
'collapsible' => ['findable' => false], // keep collapsed content out of the browser's find in page
],