Skip to content

Section & Collapsible

Both of these fold a body of children open and closed. Section is a titled panel with a header; Collapsible is an untitled row you build yourself. Reach for Section when the group has a heading, Collapsible when the trigger is the content — a settings row that reveals an inline form.

Section::make('Title', 'Description') groups content under a heading, like a Card that can also collapse and hold actions. Call ->tooltip('…') to attach an ⓘ info popover next to the title; the content may include links. Call ->collapsible() to let it fold — pass collapsed: true to start folded, or rememberState: false to not persist the state across reloads — and ->headerActions([...]) to place buttons or actions in the header.

Section::make('Members', 'People with access to this team.')
->collapsible()
->tooltip('Only admins can change who has access.')
->headerActions([
Button::make('Invite member')->emphasis(Emphasis::Outline),
])
->schema([
Text::make('Three people have access to this team.'),
Badge::make('3 active'),
]);

Collapsible::make() folds a body of children behind a clickable trigger. Pass the header content to ->trigger([...]) (any components — a label, a value, a badge) and the body to ->content([...]). It starts folded; call ->collapsed(false) to start open, and ->rememberState() to persist the open state across reloads. Unlike Section, the whole trigger row is clickable and there is no built-in title — you supply it, which makes it a good fit for settings rows that reveal an inline edit form. Call ->tooltip('…') to attach an ⓘ info popover in the trigger row; the content may include links.

Collapsible::make('account-name')
->trigger([Text::make('Name')])
->tooltip('Shown on invoices and receipts.')
->content([Text::make('Update the name shown on your account.')]);

Accordion::make() wraps Collapsible or collapsible Section children and keeps at most one of them open: opening an item closes its open sibling, and clicking the open item closes it, so the accordion can also sit fully folded. Coordination runs on the children’s keys — give every item one — and only reaches the accordion’s direct children, so a collapsible nested inside an item’s content keeps its own local state. Pass the key of the item that should start open to ->defaultOpen('…'); inside an accordion it wins over a child’s own collapsed() and rememberState(). ->gap() spaces the items like a Stack.

Accordion::make('faq')
->defaultOpen('shipping')
->schema([
Collapsible::make('shipping')
->trigger([Text::make('When does my order ship?')])
->content([Text::make('Orders placed before noon ship the same day.')]),
Collapsible::make('returns')
->trigger([Text::make('How do returns work?')])
->content([Text::make('Print a label from your account within 30 days.')]),
]);