Collapsible
A single disclosure region controlled by one trigger.
Reveal one optional region without navigating away or managing a collection of sections.
Backed by Base UI Collapsible for
upstream behavior and configuration. Zenos follows the same composition model as
shadcn/ui Collapsible: an
unstyled root, a trigger, and animated content—while keeping the compound
Collapsible.Root API.
default
panel
Composition
Section titled “Composition”Build disclosures from three parts. The root owns open state; it does not impose a card shell unless you opt in.
<Collapsible.Root> <Collapsible.Trigger>Toggle details</Collapsible.Trigger> <Collapsible.Content>Hidden content</Collapsible.Content></Collapsible.Root>Collapsible.Root├── Collapsible.Trigger└── Collapsible.ContentImport
Section titled “Import”import { Collapsible } from "@zentara-co/zenos-ui";Variants
Section titled “Variants”variant="default" (implicit) keeps Root unstyled so you can wrap Card, layout, or custom surfaces—similar to shadcn’s basic and order-detail examples. variant="panel" applies the contained disclosure shell (border, neutral card fill, full-width trigger row, content divider).
The preview above compares both.
A minimal FAQ-style disclosure: inline trigger, chevron, and supporting text below.
Order details in a card
Section titled “Order details in a card”Compose a default collapsible inside Card when the trigger should sit in a product surface rather than a standalone panel.
Status
Shipped
Tracking updates when the carrier scans the package.
Settings panel
Section titled “Settings panel”Use Collapsible.Trigger with Base UI’s render prop when a Button or other control should own the trigger element. Set showChevron={false} when the control already communicates state.
File tree
Section titled “File tree”Nested folders and files belong in File Tree. Collapsible stays the primitive for one disclosure region.
Controlled state
Section titled “Controlled state”Use open and onOpenChange when another part of the UI must read or drive the disclosure. Prefer defaultOpen for local, uncontrolled usage.
Panel is closed.
States
Section titled “States”defaultOpen sets the initial uncontrolled state. A disabled trigger stays visible but cannot open its panel.
Panel variant
Section titled “Panel variant”When you want the contained shell without wrapping Card, set variant="panel" on Root.
Custom styling
Section titled “Custom styling”Override surfaces with semantic tokens on Root, Trigger, or contentClassName. Panel variant accepts the same accent treatments as before; default variant keeps animation on Content while you style the surrounding layout.
Collapsible or Accordion
Section titled “Collapsible or Accordion”Use Collapsible for one optional region. Use Accordion when several related sections need heading structure and shared list behavior. Use File Tree for nested folders and files.
Variants
defaultpanel Collapsible.Root Collapsible.Trigger Collapsible.Content
API
| Prop | Type | Default | Description |
|---|---|---|---|
Root.variant | default | panel | default | Default leaves Root unstyled for Card and layout composition; panel applies the contained disclosure shell. |
open | boolean | — | Controlled expanded state. |
defaultOpen | boolean | false | Initial uncontrolled state. |
onOpenChange | (open: boolean, eventDetails) => void | — | Runs when state changes. |
Trigger.disabled | boolean | false | Prevents Trigger activation. |
Trigger.showChevron | boolean | true | Shows the built-in disclosure chevron. |
Trigger.render | ReactElement | function | — | Composes Trigger with another element. |
Content.contentClassName | string | — | Adds classes to the inner content wrapper without changing panel animation. |
Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props,
including className, style, aria-*, and data-*.
Accessibility
Section titled “Accessibility”The trigger is a native button (or the element passed to render) and exposes aria-expanded. Enter and Space toggle it when focused. Keep labels meaningful, preserve visible focus, and avoid nesting interactive controls inside the trigger unless they stop propagation. Motion-reduction preferences disable height and chevron transitions.