Skip to main content
Brand and assets
Build
Monitor and contribute
/
Component library
  • All components
  • Buttons & actions
  • Forms & inputs
  • Layout & containers
  • Overlays
  • Feedback & status
  • Data display
    • Accordion
    • Accordion
    • Avatar
    • Avatar
    • Blobby
    • Card
    • Card
    • Collapsible
    • Divider
    • Emoji
    • Emoji
    • Gradient
    • Gradient
    • Icon
    • Image
    • ListItem
    • ListItem
    • ResponsiveImage
    • SemanticList
    • Tag
    • Timeline
  • Typography
  • Accessibility
  • Contrib
  • Deprecated
  • Data display
  • Collapsible

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
Component health
Source
View on Github
Storybook
View in 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

NameTypeDefault ValueDescriptionUsage count
defaultOpenbooleanundefined
onOpenChange((open: boolean) => void)undefined
openbooleanundefined
Edit this page
Previous
Card
Next
Divider
  • Get the open state in the trigger
  • Default open state
  • Controlled