Ask Natuna

Ask about the design system

Hi, I am Natuna.

Ask me about the design system: components, tokens, statuses, and how to use them.

Natuna can be wrong. The docs are the source of truth.

Skip to content
  • IntroductionPage
  • Ask NatunaAsk about the design systemPage
  • FoundationColor, type, number, effectPage
  • Components overviewPage
  • ThemesLight and dark modePage
  • NamingProperty and page namesPage
  • Privacy statementPage
  • Text-safe stepsFirst AA and AAA step per color rampSection
  • AccessibilityWCAG 2.2 AAA rulesSection
  • Dark modeThemesSection
  • Using it todayFigma file and React codeSection
  • Component statusDesign status and In ReactSection

Arrow keys to move, Enter to open, Esc to close.

Button Group

A set of related buttons, visually grouped together as a single control.

Status
Not tracked
Code
In React
Role
Action

Usage

This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.

Showing the grid view.

Pastes as editable layers. Shadows are not exported.

import { useState } from "react";
import { ListBullets, SquaresFour } from "@phosphor-icons/react";
import { ButtonGroup, type ButtonGroupOption } from "@/ui";

const VIEW_OPTIONS: ButtonGroupOption[] = [
  { value: "grid", label: "Grid", icon: <SquaresFour size={18} /> },
  { value: "list", label: "List", icon: <ListBullets size={18} /> },
];

export default function ButtonGroupDemo() {
  const [view, setView] = useState<string>("grid");

  return (
    <>
      <ButtonGroup label="View" value={view} onChange={setView} options={VIEW_OPTIONS} />
      <p aria-live="polite">Showing the {view} view.</p>
    </>
  );
}

Variants and states

Every specimen is the real component from src/ui, held in one state.

size mdtext, icon and text, icon only
size lgtext, icon and text, icon only
Disabled optionone segment unavailable
fullWidthequal segments

Pastes as editable layers. Shadows are not exported.

Props

label
string · default none
Required. Names the group for screen readers, such as "View".
options
{ value, label, icon?, iconOnly?, disabled? }[] · default none
Required. Two to four segments. With iconOnly, the label becomes the button's aria-label.
value
string · default none
The chosen value, when you control it.
defaultValue
string · default first enabled option
The starting value when uncontrolled. One segment is always chosen.
onChange
(value: string) => void · default none
Called with the value of the pressed segment.
size
"md" | "lg" · default "md"
44px or 48px tall. Icon-only segments are square.
fullWidth
boolean · default false
Stretch to the container with equal segments.
className
string · default ""
Extra classes on the group.

Figma to code

Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.

📐 Size
size
md and lg.
🎯 State
value, options[].disabled
Selected is the chosen value. Hover and focus come from the browser.
🖍 Label
options[].label
Per segment.
☘️ Icon
options[].icon, options[].iconOnly
Per segment. Icon-only keeps the label as the accessible name.

Accessibility

What the code in src/ui does today, and what it leaves to you.

Keyboard

  • Tab moves through each segment. Enter and Space choose it. Disabled segments are skipped.

Screen readers

  • A group named by label. Each segment is a toggle button with aria-pressed, so the chosen one is read as pressed.
  • Icons are aria-hidden. An icon-only segment is named by its label.

What you still need to do

  • Show the result of the choice, such as switching the view, right away. A segment is a choice, not a submit.
  • Use Tabs instead when each choice shows a different panel of content.
  • This component draws no focus indicator of its own. On this site a global :focus-visible rule draws a 2px outline in the border/focus role (--color-role-border-focus). Copy the role tokens and that rule, or an equivalent, into your app.

When to use

Segmented choices such as view toggles (grid/list) or grouped filters.

Do and don't

Do

  • Keep labels short so groups stay compact.
  • Use for mutually exclusive choices.

Don't

  • Mix unrelated actions in a single group.
  • Put more than four options in one group. Two to four options stay easy to scan.

Other untracked components.

Status reflects the component tracker snapshot of 29 October 2026.