Component libraryToggle group
Toggle group
ProChoose one or several compact modes with pressed buttons and roving keyboard focus.
npx shadcn@latest add @tidal-pro/toggle-groupInstallation
Pro source is gated. Configure the @tidal-pro registry using the agent guide. Create an access key from your account after purchasing.
Terminal
Import components/ui/tidal.css, components/ui/toggle-group.css, then add the component inside a tidal-scope wrapper. Its scoped design tokens keep it independent of your existing CSS.
Usage
Complete example source · Dependency and asset manifest
Loading the complete example…
API & behavior
A discriminated controlled API uses type='single' with string|null value or type='multiple' with a string array value. onValueChange proposes the next value without mutating consumer state. label names the form-free role=group. Items require unique IDs and values and support ReactNode labels, optional accessibleLabel for icon-only content, decorative icons, disabled state, native button attributes and individual refs. Buttons are always type=button, expose aria-pressed, and never serialize a form value. Caller click/keydown/focus handlers run first; prevention blocks activation or keyboard movement. One enabled item is tabbable; Home/End and orientation-aware arrow keys wrap while skipping disabled items, with Left/Right reversed in RTL. Horizontal groups scroll inline rather than clipping. Root props/ref, orientation, direction and disabled state are available. Consumers own state, validation, persistence and any focus movement after an accepted toggle.
Style with the --t-* CSS variables. Set data-theme="dark" on your tidal-scope wrapper for a dark surface. Motion respects the system’s reduced-motion preference.