Button Group

ButtonGroup frames related controls as one NeoBrutalist unit, with a shared border, shadow, and press motion. It also includes components for inline text and separators.

Button Group
LIVE · running in a sandboxed iframe
Installed with shadcn add · 1 workaround · theme from the install docs
  • applied the registry's theme (tokens, fonts and CSS from the registry preview settings)
See how it was built

Installation

pnpm dlx shadcn@latest add https://neobrutalism.com/r/button-group.json

Usage

usage.tsx
import {  ButtonGroup,  ButtonGroupSeparator,  ButtonGroupText,} from "@/components/ui/button-group"export function ButtonGroupExamples() {  return (    <>      <ButtonGroup aria-label="Text formatting">        <button type="button">Bold</button>        <ButtonGroupSeparator />        <button type="button">Italic</button>        <ButtonGroupText>Format</ButtonGroupText>      </ButtonGroup>      <ButtonGroup orientation="vertical" aria-label="Playback controls">        <button type="button">Play</button>        <button type="button">Pause</button>      </ButtonGroup>      <ButtonGroup aria-label="Grouped actions">        <ButtonGroup aria-label="Document actions">          <button type="button">Save</button>          <button type="button">Print</button>        </ButtonGroup>        <ButtonGroup aria-label="Sharing actions">          <button type="button">Share</button>          <button type="button">Copy link</button>        </ButtonGroup>      </ButtonGroup>    </>  )}
  • Group related actions, such as adjacent navigation or formatting controls.
  • Present a compact set of options whose segments should read as one control.
  • Add a short label or status alongside grouped buttons with ButtonGroupText.
  • Separate segments visually, or compose independent nested groups.

Examples

Horizontal formatting controls

Group related actions with an optional separator and text label.

horizontal-formatting-controls.tsx
import {  ButtonGroup,  ButtonGroupSeparator,  ButtonGroupText,} from "@/components/ui/button-group"export function FormattingControls() {  return (    <ButtonGroup aria-label="Text formatting">      <button type="button">Bold</button>      <ButtonGroupSeparator />      <button type="button">Italic</button>      <ButtonGroupText>Format</ButtonGroupText>    </ButtonGroup>  )}

Vertical controls

Stack related actions by setting the group's orientation.

vertical-controls.tsx
import { ButtonGroup } from "@/components/ui/button-group"export function PlaybackControls() {  return (    <ButtonGroup orientation="vertical" aria-label="Playback controls">      <button type="button">Play</button>      <button type="button">Pause</button>    </ButtonGroup>  )}

Nested groups

Place independent groups inside a parent; nested groups become separate pressable units.

nested-groups.tsx
import { ButtonGroup } from "@/components/ui/button-group"export function GroupedActions() {  return (    <ButtonGroup aria-label="Grouped actions">      <ButtonGroup aria-label="Document actions">        <button type="button">Save</button>        <button type="button">Print</button>      </ButtonGroup>      <ButtonGroup aria-label="Sharing actions">        <button type="button">Share</button>        <button type="button">Copy link</button>      </ButtonGroup>    </ButtonGroup>  )}

API reference

PropTypeDefaultDescription
ButtonGroupReact.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>—Accepts native div props and the orientation variant. Sets role="group", data-slot="button-group", and data-orientation; className can add or override styling.
orientation"horizontal" | "vertical" | null"horizontal"Controls the group's layout and segment seam direction.
ButtonGroupTextuseRender.ComponentProps<"div">—Accepts the useRender div props, including render, and renders as a div by default. Sets the button-group-text slot and applies inline label styling.
ButtonGroupSeparatorReact.ComponentProps<typeof Separator>—Accepts the imported Separator component's props. Its orientation defaults to vertical; the supplied orientation is forwarded to Separator.
classNamestring—A native div className for ButtonGroup, ButtonGroupText, or ButtonGroupSeparator, merged with that component's styles.

Accessibility

  • ButtonGroup sets role="group" but does not provide an accessible name; give each group an aria-label or connect it to a visible label with aria-labelledby.
  • Use semantic, keyboard-operable controls such as native buttons or links as group segments; ButtonGroup does not add keyboard interaction or roving focus.
  • ButtonGroupText is rendered as a div by default and is not automatically associated with the group as its accessible label.
  • The component raises focused segments above adjacent segments with z-index styling, but does not itself add focus behavior.

Docs written by openai:gpt-6-luna from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Button Group" component (neobrutalism/button-group) from its shadcn registry.1. Install it with: npx shadcn@latest add https://neobrutalism.com/r/button-group.json2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: ButtonGroup, orientation, ButtonGroupText, ButtonGroupSeparator, className.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport {  ButtonGroup,  ButtonGroupSeparator,  ButtonGroupText,} from "@/components/ui/button-group"export function ButtonGroupExamples() {  return (    <>      <ButtonGroup aria-label="Text formatting">        <button type="button">Bold</button>        <ButtonGroupSeparator />        <button type="button">Italic</button>        <ButtonGroupText>Format</ButtonGroupText>      </ButtonGroup>      <ButtonGroup orientation="vertical" aria-label="Playback controls">        <button type="button">Play</button>        <button type="button">Pause</button>      </ButtonGroup>      <ButtonGroup aria-label="Grouped actions">        <ButtonGroup aria-label="Document actions">          <button type="button">Save</button>          <button type="button">Print</button>        </ButtonGroup>        <ButtonGroup aria-label="Sharing actions">          <button type="button">Share</button>          <button type="button">Copy link</button>        </ButtonGroup>      </ButtonGroup>    </>  )}```

Files & dependencies

  • button-group.tsx→ components/ui/button-group.tsx
dependencies@base-ui/reactclass-variance-authority
registryDependenciesseparator
Uses from @neobrutalism

Looks similar, elsewhere