Toggle
Toggle Group
NewA toolbar of toggle buttons where one stays pressed with a sliding thumb, or several toggle on their own.
npx motionsnack add toggle-groupCustomize
<ToggleGroup />Props
12 properties
| Property | Type | Default | Description |
|---|---|---|---|
| items | { value: string; label: string; icon?: ToggleGroupIcon; disabled?: boolean }[] | 4 alignment buttons | Buttons in one row. Icons: bold, italic, underline, strikethrough, align-left, align-center, align-right, align-justify, list, list-ordered, link, code. |
| groups | ToggleGroupItem[][] | - | Buttons split into groups with a thin separator between them. Replaces items. |
| value | string | string[] | - | Controlled value: a string for single, an array for multiple. |
| defaultValue | string | string[] | 'left' | Value on first render when uncontrolled. |
| onChange | (value: string | string[]) => void | - | Called with the new value. |
| className | string | '' | Extra classes on the wrapper. |
| type | 'single' | 'multiple' | 'single' | Single: one button is pressed at a time and a thumb slides to it. Multiple: every button toggles on its own. |
| label | string | 'Alignment' | Name of the group for screen readers and its legend. |
| showLabel | boolean | true | Show the label above the bar. |
| showLabels | boolean | false | Show each button's label next to its icon. |
| allowEmpty | boolean | false | In single mode, clicking the pressed button releases it. |
| disabled | boolean | false | Disables the whole group. |
About Toggle Group
Toggle Group is the button bar from every editor: text alignment, bold and italic, list styles, a grid or list view. In single mode the buttons behave like radios and a soft thumb slides to the one that is pressed; in multiple mode every button toggles on its own and fades its fill in and out. Buttons can be icons from a built-in set of twelve, with their names as tooltips, or icons with labels, and thin separators split them into groups. The pressed look is a soft tint or a solid black or white fill, in two sizes. Arrow keys, Home and End move between buttons with a single tab stop, following the radio group and toolbar patterns, and keyboard focus shows the library's soft outline.
What's included
- Single mode with a sliding thumb
- Multiple mode with fills that fade in
- Twelve built-in icons, or icons with labels
- Groups with thin separators
- Soft or solid pressed look, two sizes
- Roving tab stop and arrow keys
- Light and dark look
- Type
- Animated React toggle component
- Library
- Components · Toggle
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23
- Install
npx motionsnack add toggle-group