Skip to main content

Overview

@badrinteractive starred 3 repos
Collapsible provides a simple toggle to show or hide a section of content. Unlike Accordion, it manages a single open/close state without any grouping logic — ideal for sidebars, filters, and expandable detail panels.
Use Accordion when you need multiple collapsible sections with grouped behavior. Use Collapsible for a single standalone expand/collapse.

Installation


Usage


Variants

Basic

Starred repositories
@badrinteractive/araf-ds-core
@badrinteractive/araf-ds-docs
@badrinteractive/araf-ds-tokens

Filter Panel

A common pattern for sidebar filter sections.
Status

API Reference

Collapsible

boolean
Controlled open state.
(open: boolean) => void
Callback fired when open state changes.
boolean
default:"false"
Uncontrolled default open state.
boolean
default:"false"
Prevents the collapsible from being opened or closed.

CollapsibleTrigger

boolean
default:"false"
Render as a child element (e.g. a Button) instead of a default <button>.

CollapsibleContent

Animates open and close with a CSS height transition. No additional props required.

Accessibility

  • CollapsibleTrigger renders as <button> with aria-expanded="true|false"
  • CollapsibleContent has aria-hidden="true" when closed
  • The trigger and content are linked via aria-controls and id
  • Keyboard: Space/Enter on the trigger toggles open state

Do’s & Don’ts

Do

  • Use defaultOpen for sections that should start expanded
  • Always show some content outside the collapsible as a summary
  • Use asChild to make any element the trigger (a heading, row, etc.)
  • Use Collapsible for single sections; Accordion for multiple grouped sections

Don't

  • Don’t hide critical information inside a collapsed section by default
  • Don’t use Collapsible when only one section should be open at a time — use Accordion with type="single"
  • Don’t nest Collapsibles more than 2 levels deep
  • Don’t forget a visible toggle indicator (chevron icon) for discoverability