A two-state button that can be either on or off. Plays a toggle sound.
A two-state button that can be either on or off. The sensory-ui Toggle plays a toggle sound on state change, confirming the state transition.
Pattern: Single-sound
npx shadcn@latest add SatyamVyas04/sensory-ui/sensory-ui-toggleimport { Toggle, toggleVariants } from "@/components/ui/sensory-ui/toggle";| Prop | Type | Default | Description |
|---|---|---|---|
sound | SoundRole | false | "interaction.toggle" | Sound played on toggle. |
volume | number | 1 | Per-component volume multiplier (0–1). |
interaction.toggle
<Toggle aria-label="Toggle bold">B</Toggle><Toggle sound="interaction.confirm" volume={0.8}>
B
</Toggle><Toggle sound={false}>
B
</Toggle><div className="flex gap-1">
<Toggle aria-label="Toggle bold" sound="interaction.toggle">B</Toggle>
<Toggle aria-label="Toggle italic" sound="interaction.toggle">I</Toggle>
<Toggle aria-label="Toggle underline" sound="interaction.toggle">U</Toggle>
</div><Toggle aria-label="Toggle favorite" sound="interaction.confirm">
<IconHeart className="size-4" />
</Toggle>| Prop | Value |
|---|---|
sound | "interaction.toggle" |
volume | 1 |
| Situation | Recommended Sound | Why |
|---|---|---|
| Formatting toolbar | interaction.toggle | Standard state change |
| Favorite/like | interaction.confirm | More rewarding feedback |
| Mute/unmute | interaction.toggle | State change confirmation |
| Silent toggle | false | For rapid toggling |
| Event | Default Sound |
|---|---|
| Toggle on/off | interaction.toggle |
View the original Toggle documentation.