Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Toggle Group examples · Sizes

Large Toggle Group for React

A large outline formatting toggle group.

Framework
UI library

Touch-first and accessibility-focused interfaces need bigger targets. This React example is an outline Toggle Group on Base UI with size="lg" set on the group, so bold, italic and underline are each one step taller than the default, with more padding around the icons. Multiple selection lets the formats combine.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

When should I use large toggle groups?

Use lg when the group is the main control on the screen, when there are only a few options, or when people use it with touch: tablet editors, kiosks, presentation tools. Avoid it in dense toolbars, where the extra size takes room without helping.

Are large toggle groups better for accessibility?

Larger targets are easier to hit for people with limited dexterity and easier to see for people with low vision. In most styles lg is still a little under the 44 pixel touch target, so keep spacing between the items as well. The names and pressed states are announced the same at every size.

How much horizontal space do large toggle groups require?

Each item is wider and taller than at the default size, and the group's spacing adds a gap between them. Three icon-only items fit easily even on a phone; with more, or with text labels, set orientation="vertical" or split the options into separate groups.

Should I use larger icons with large toggle groups?

Not necessarily. The items keep the icon at its usual size (size-4 in most styles) and put the extra size into padding, which is what makes them easier to hit. If an icon looks lost, give it size-5, but don't let it fill the button.

Do large toggle groups work well on mobile devices?

Yes, they're the best fit of the three sizes for touch. The limit is width: keep the group to a few items, or stack it with orientation="vertical" on narrow screens.

Should large toggle groups scale down on desktop?

Not if there's room. Large targets help desktop users with screen magnifiers or alternative pointing devices too. Choose the default size instead when the toolbar has many controls, and keep one size per toolbar.