Weftv0.4.0
GitHubFigma
Blade AI
Display · Collapsiblestable

Collapsible

Shows or hides one block of content when the trigger is pressed, such as a fee breakdown or advanced settings. The label can change when expanded, and the panel opens below or above the trigger.

Preview

#preview

Change the options and the code follows. Show code opens the React snippet.

Gross amount$12,504.96
Platform fee (0.16%)−$20.00
GST on fee−$3.60
Net settled$12,481.36
collapsible-example.tsx
import { Collapsible } from "@blade-ai/weft/components/collapsible";

<Collapsible
  label="Show fee breakdown"
  expandedLabel="Hide fee breakdown"
>
  <FeeRows />
</Collapsible>

All states

#all-states

Collapsed, expanded, both directions and trigger states, from the Collapsible artboard.

Collapsible · 6 states
Collapsed
Gross amount$12,504.96
Platform fee (0.16%)−$20.00
GST on fee−$3.60
Net settled$12,481.36
Expanded
Gross amount$12,504.96
Platform fee (0.16%)−$20.00
GST on fee−$3.60
Net settled$12,481.36
Direction · Top
Hover
Focus
Disabled

Props

#props

Read from the component source. Booleans are is-prefixed. A star marks a required prop.

Prop
Type
Default
Description
label *
string
—
Trigger text while collapsed.
expandedLabel
string
—
Trigger text while expanded. Defaults to label.
children *
ReactNode
—
Panel content.
isOpen
boolean
—
Controlled open state. Use with onOpenChange.
isDefaultOpen
boolean
false
Initial open state when uncontrolled.
onOpenChange
(isOpen: boolean) => void
—
Fires when the trigger toggles the panel.
direction
"bottom" | "top"
"bottom"
Where the panel opens relative to the trigger.
isDisabled
boolean
false
—

Usage

#usage

Short rules for choosing and writing collapsible.

Do
Hide secondary details only; keep the key information visible.
Say what will appear in the label and change it when expanded.
Use one collapsible for one optional block.
Don't
Hide the main amount or status behind a toggle.
Stack several collapsibles; use an Accordion.
Put long forms inside a collapsible.

Accessibility

#accessibility

The trigger is a button that controls a region. Hidden content is removed from the accessibility tree.

Keyboard
Key
Action
Enter / Space
Toggles the content.
Tab
Moves to the trigger, then into the content when expanded.
ARIA
Element
Role / attribute
When
Trigger
button · aria-expanded · aria-controls
Always.
Panel
id referenced by aria-controls
Hidden while collapsed.
Chevron
aria-hidden="true"
Decorative.