Collapsible

Layout

One section that opens and closes: <Collapsible.Root> (bind:open) holds a Collapsible.Trigger (a button; render your own with the child snippet) and a Collapsible.Content, which slides open.

import { Collapsible } from '@limerdev/zest';
Collapsible for AI tools (llms.txt)
Use for
Optional detail under something visible: advanced options in a form, the lines behind a total, older entries.
Don't
Several sections under headings: use Accordion. Content everyone needs: show it.

Examples

Basic

Optional detail under a total. The trigger is your own Button through child.

Invoice 1042 · 12 400 kr

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

Collapsible.Root

Prop Type Default Description
disabled boolean false Whether the collapsible is disabled.
onOpenChange OnChangeFn<boolean> – A callback function called when the open state changes.
onOpenChangeComplete OnChangeFn<boolean> – A callback function called when the open state changes complete.
open bindable boolean false Whether the collapsible is open.

Collapsible.Trigger

Prop Type Default Description
size "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" 'default' The height and padding, from the theme's field size; the icon sizes are square.
variant "link" | "primary" | "secondary" | "neutral" | "error" | "outline" | "ghost" 'primary' The look, by the theme's colour roles: primary for the main action, error for deleting, secondary, neutral and outline for the rest, ghost in toolbars, link for a navigation that looks like text.

Collapsible.Content

Prop Type Default Description
forceMount boolean false Whether to force mount the content to the DOM.
hiddenUntilFound boolean true Whether to allow the browser to expand the content when searching for content within the panel via the browser's built-in search functionality. When true, this prop will override the forceMount prop.