Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Toggle examples · Sizes

Large Toggle for React

A large icon-only toggle for underline.

Framework
UI library

Some toggles are the main controls on the screen and should be easy to see and hit. This React example is an underline Toggle on Base UI with size="lg", one step taller than the default with more padding around the icon. Use it in touch-first layouts, presentation and kiosk screens, or simplified editors with only a few controls.

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 buttons?

Use lg when there are few toggles and they're the main action, or when people use the screen with touch. Avoid it in dense toolbars, where the extra height and padding take space without helping.

Are large toggles better for accessibility?

A bigger target is easier to hit for people with limited dexterity and easier to see for people with low vision. In most styles, though, lg is still a little under the 44 pixel touch target, so on touch screens also leave space between toggles. The name and pressed state are announced the same at every size.

Should I use larger icons with large toggles?

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

Can I group multiple large toggles together?

Yes, with the Toggle Group and size="lg", as the Large Toggle Group example does. Large items take more width, so keep a group to a few options, or set orientation="vertical" to stack them in a narrow space.

Should large toggles include text labels?

They have room for one. Add the text after the icon inside the Toggle, as the Toggle with Text example does, and drop the aria-label, since the text becomes the name. Labels help most in simplified interfaces for people who don't know the icons.

Do large toggles need to scale down on mobile?

Usually not: the larger target helps most on touch screens, where fingers are less precise than a mouse. Scale down only if the toolbar no longer fits, and then prefer fewer toggles or a vertical layout over smaller ones.