Collapsible

An interactive component which expands and collapses a panel. Plays expand and collapse sounds.

An interactive component which expands and collapses a panel. The sensory-ui Collapsible plays distinct sounds for expand and collapse actions, reinforcing the content movement.

Pattern: Open sound / close sound

Demo

Live demoSwitch sound packs to compare

Installation

npx shadcn@latest add SatyamVyas04/sensory-ui/sensory-ui-collapsible

Import

import {
  Collapsible,
  CollapsibleContent,
  CollapsibleTrigger,
} from "@/components/ui/sensory-ui/collapsible";

Sound Props

PropTypeDefaultDescription
openSoundSoundRole | false"overlay.expand"Sound played when expanding.
closeSoundSoundRole | false"overlay.collapse"Sound played when collapsing.
volumenumber1Per-component volume multiplier (0–1).

Default Sound Role

overlay.expand on expand, overlay.collapse on collapse.

Usage

<Collapsible>
  <CollapsibleTrigger>Toggle</CollapsibleTrigger>
  <CollapsibleContent>
    Content goes here.
  </CollapsibleContent>
</Collapsible>

Custom sounds

<Collapsible openSound="interaction.confirm" closeSound="interaction.subtle">
  {/* ... */}
</Collapsible>

Disable sounds

<Collapsible openSound={false} closeSound={false}>
  {/* ... */}
</Collapsible>

Customizations

<Collapsible openSound="overlay.expand" closeSound="overlay.collapse">
  <CollapsibleTrigger>Show filters</CollapsibleTrigger>
  <CollapsibleContent>
    {/* Filter options */}
  </CollapsibleContent>
</Collapsible>

Inline reveal

<Collapsible openSound="interaction.tap" closeSound="interaction.subtle">
  <CollapsibleTrigger>Read more</CollapsibleTrigger>
  <CollapsibleContent>
    {/* Extended content */}
  </CollapsibleContent>
</Collapsible>

Default Props

PropValue
openSound"overlay.expand"
closeSound"overlay.collapse"
volume1

Tasteful Sound Choices

SituationRecommended SoundWhy
Filter panelsoverlay.expand / overlay.collapseClear spatial expansion
Read more linksinteraction.tap / interaction.subtleLighter content reveal
Settings sectionsoverlay.expand / overlay.collapseStructural movement
FAQ itemsoverlay.expand / overlay.collapseConsistent with Accordion

When to Use

  • Filter panels: Show/hide filter options
  • Content previews: Read more / show less
  • Settings sections: Collapsible settings groups
  • Sidebar items: Collapsible navigation sections

Avoid sound on

  • Multiple collapsibles open at the same time
  • Collapsibles used for critical navigation

Event Triggers

EventDefault Sound
Panel expandsoverlay.expand
Panel collapsesoverlay.collapse

shadcn/ui Reference

View the original Collapsible documentation.