Skip to main content

Collapsible

One section that opens and closes.

In Dense data

See it live​

Start Storybook to see it live: npm run storybook

When to use it​

In Dense data: One block of extra filters or advanced options analysts open when needed. Not for content everyone needs.

  • Use it when: A single block of extra detail people may want: more filters, advanced options.
  • Not when: Several stacked sections (accordion), or content everyone needs.

Instead:

Words​

  • Lead with the object, then the state: "Alert 2041 contained."
  • Use numbers, not words for numbers.
  • One verb per button. No "please", no exclamation marks.
  • Use: Investigate, Filter, Assign, Escalated, Resolved. Avoid: Oops, Awesome, Please, Simply.

The labels components use, from the voice tokens:

  • content.action.commit: Save
  • content.action.cancel: Cancel
  • content.action.destroy: Delete
  • content.action.retry: Retry
  • content.action.empty-action: Change filters

See Voice and tone for the whole voice.

Accessibility and keyboard​

KeyboardWhat happensNot
undefinedEnter or Space opens and closes.undefined

Test before you ship:

  • The trigger is a button that says whether it is open. undefined

Use it in code​

npx open-ds add collapsible

The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.

Tokens it reads​

Collapsible sets no colors, corners or shadows of its own; it takes them from the components inside it.