Collapsible
Shows or hides any element behind a trigger. Use for a single piece of optional detail; use `Accordion` for a list of them.
Health
Source
Storybook
Playground
No Example
Accessibility
compliant
Platform
Universal
- Overview
- Props
Get the open state in the trigger
Like for changing the orientation of an arrow or customizing text according the open state, you can pass a function into the <Toggle.Trigger> children to get the open state as parameter.
Default open state
If you need to get the content opened by default, you can use the defaultOpen props.
Hello there
Controlled
If you need to add external control, you can pass an open and an onOpenChange props.
If you have an advanced need, like add a toggle all button, you can take inspiration from the Storybook example.
tip
This component is universal, its usage is the same in
murray and murray/mobile.Collapsible props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| defaultOpen | booleanundefined | |||
| onOpenChange | ((open: boolean) => void)undefined | |||
| open | booleanundefined |