Measured entry

shadcn-button-group

buttonunclassified

A source-copied React primitive for visually joining buttons, labels, and separators in horizontal or vertical groups. It ships as Tailwind-styled component code and relies on the shadcn class-merging helper, class-variance-authority, Radix Slot, and the companion Separator primitive.

Specimen
Harness screenshot of shadcn-button-group at 375 pixels wide
Harness screenshot at 375 pixels wide. No horizontal overflow recorded.
Harness screenshot of shadcn-button-group at 768 pixels wide
Harness screenshot at 768 pixels wide. No horizontal overflow recorded.
Harness screenshot of shadcn-button-group at 1440 pixels wide
Harness screenshot at 1440 pixels wide. No horizontal overflow recorded.

Measured

Every value below was written by the harness on the run that produced the frames above. None of it is derived from the prose.

Harness measurements recorded for shadcn-button-group
BuildOK
MountOK
Console errors0
Uncaught page errors0
Horizontal overflowclean at 375, 768, 1440
Axe critical0
Axe serious0
Axe moderate0
Axe minor0
Gzip marginal32.2 KB (97.7 KB build, 65.5 KB baseline)
Bare modeFAIL
Provider requiredNO
Demo usedwritten from the component source API

What the harness recorded

BARE BUILD

✗ Build failed in 1.53s
error during build:
[vite]: Rollup failed to resolve import "class-variance-authority" from "<sandbox>re-ff2bc5942c29/src/cut/components/ui/button-group.tsx".

Verdict

A dependable layout primitive when the surrounding controls already own their state and semantics. It built and mounted cleanly, stayed contained across the tested layouts, and produced no automated accessibility findings, but it is not a full interaction pattern by itself.

Use it if

  • You need a compact toolbar or view switcher whose adjacent controls share borders and corner treatment.
  • Your React app already uses Tailwind and shadcn conventions, including the shared class-merging helper.
  • You want horizontal and vertical grouping while retaining control over the actual buttons and their behavior.

Skip it if

  • You need a complete segmented-control widget with selection state and keyboard behavior built in.
  • Your design system avoids Tailwind utility classes or source-copied components.
  • You want a dependency-free wrapper and do not already carry the Radix and variant-class utilities.

Install

Installation record for shadcn-button-group
Declared dependenciesradix-ui, clsx, tailwind-merge
Missing on installnone
Bare installfails once the shadcn-style helpers are removed, so it needs that setup
Providerno provider required in the harness

In a non-shadcn project, add Tailwind, class-variance-authority, Radix UI, clsx, and tailwind-merge; provide a compatible cn helper and copy or replace the Separator primitive. Also map the source import aliases to your project structure.

Source and credit

This page is a review, not a copy. The component source lives with its author and this site does not republish it. Read the license before you use anything.

Author repository

github.com/shadcn-ui/ui
License
MIT
Record published
2026-08-16

Alternatives

Other published entries for the button pattern, ordered by what they measured: mounts first, then clean axe scans, then bare-mode passes, then the smaller bundle.