Toggle Group Examples
7 toggle groups: formatting toolbars with multiple selection, an alignment picker with single selection, the outline variant, a disabled group and three sizes. Each on React, Vue, Svelte and Solid, with Base UI, React Aria, Ark UI or Radix UI on React.
Every toggle group example
7 examples.
- Default Size Toggle GroupSizesAn outline group of three icon buttons for bold, italic and underline, at the default size. None of them start pressed.

- Default Toggle GroupStandardThree separate icon buttons for bold, italic and underline. Several can be pressed at once, and none start pressed.

- Disabled Toggle GroupStandardA formatting group of bold, italic and underline that is disabled. The buttons are faded and cannot be pressed.

- Large Toggle GroupSizesA large outline group of bold, italic and underline. The buttons are taller than the default, and none start pressed.

- Outline Toggle GroupStandardAn outline group of bold, italic and underline. Each button has a border while it is off, and none start pressed.

- Single Selection Toggle GroupStandardAn outline group of align-left, align-center and align-right icons. Only one can be pressed, and none start pressed.

- Small Toggle GroupSizesA small outline group of bold, italic and underline, shorter than the default, for a compact toolbar. None start pressed.

Or describe it. With Pro, your AI agent installs the toggle group example you describe, on your framework and UI library.
Get ProGalleries
More component examples
8 related galleries, free: open one for its live examples and their code.
Pricing
Toggle Group examples MCP, with Pro
Your AI agent installs any of the 1364 examples, and every component, block and icon, with every Pro plan.
4.9/5 out of 5 · 150+ reviewsfrom 150+ founders and developers.
- Secure checkout via Stripe
- Code lives in your repo
- Keep what you've shipped if you cancel
- License terms
FAQ
Frequently asked questions
A row of toggle buttons that share one state: text alignment, where one option is pressed at a time, or bold, italic and underline, where several can be on together. Each example here is shadcn.io's Toggle Group, styled with Tailwind CSS, for React on Base UI, React Aria, Ark UI and Radix UI, and for Vue, Svelte and Solid on Ark UI.
Yes. Every example is free to use in personal and commercial projects, with no attribution. Seeing the code and installing it takes a free shadcn.io account.
A Toggle Group fits choices that read at a glance from an icon, like alignment or formatting. A Radio Group fits labeled options people compare before choosing, like plans. Tabs switch between panels of content.
Single selection when the options exclude each other: text can't be left- and right-aligned at once. Multiple selection when they combine: text can be bold and italic. Every target allows one pressed item by default; multiple selection is `multiple` on Base UI, Ark UI, Vue, Svelte and Solid, `selectionMode="multiple"` on React Aria, and `type="multiple"` on Radix UI, where `type` is required.
Set `size` on the group, `sm`, `md` (the default) or `lg`, and every item follows it. Use `sm` in dense toolbars and `lg` on touch screens.
Set `variant="outline"` on the group: every item gets a border, and pressed items fill with the muted background. Set it once on the group rather than on each item.
Disable the group to disable every item, or one item on its own: `disabled` on most targets, `isDisabled` on React Aria. Disabled items keep their pressed look and ignore clicks and the keyboard.
Sign in with a free account, open the example and run the install command it shows. It adds the example and the Toggle Group component it uses to your project, for your framework and UI library.
Pass the pressed items and listen to changes. On Base UI, Ark UI, Vue, Svelte and Solid the value is an array of item values, even with single selection. On Radix UI it's a string with `type="single"` and an array with `type="multiple"`. On React Aria it's `selectedKeys`, a set of item ids, with `onSelectionChange`.
Put only the icon in each item, hide it with `aria-hidden`, and give the item an `aria-label` such as Toggle bold. To show the name on hover too, wrap the item in a Tooltip.
shadcn.io's Toggle Group (built on Base UI, React Aria, Ark UI or Radix UI in React, and on Ark UI in Vue, Svelte and Solid), Tailwind CSS and Lucide icons.
Yes. The group is one Tab stop and the arrow keys move between items; Space and Enter press them. Screen readers announce whether each item is on. Every example labels the group and its icon-only items with `aria-label`.
Yes, and the groups look the same on every target. The props that differ between libraries are the selection mode, the value and the disabled prop, as described above.
4.9 out of 5 from 150+ developers
Every toggle group example. One prompt away.
Every toggle group example is free with an account. With Pro, your AI agent installs them from a prompt.
Get Pro

















