Skip to contentKino
Skip to Content

Button group

Buttons joined in a row or a column. One highlight glides from button to button under the pointer and takes the shape of each.

npx shadcn add https://kinoui.com/r/button-group.json
Share on

Examples

LED-482 · Invoice totals are off by a cent

Ledger web app · Cycle 14 · In review
3 of 14

Line items round before they are summed, so a 3-line invoice can land one cent over the quote. Round the total once, at the end.

PRPriya Ramanopened #1184 · 4 files
The 4 commits become one on main.

Default

Put Buttons in a ButtonGroup and name the group with aria-label. A menu trigger, a link or a filled button joins the row the same way. For one action with a menu of others beside it, use the Split button (opens in a new tab).

Floor plans

12 Harbour Street · uploaded by Tomás Alvarez
Level 2 of 4

Text and vertical

ButtonGroupText puts a label in the row, such as where you are. orientation="vertical" stacks the buttons.

Groups inside a group

A group of groups keeps a gap between them, and each one glides on its own.

Changing label

A button in the group can load and change its label: its neighbours make room, and the highlight follows its new size.

Installation

npx shadcn@latest add https://kinoui.com/r/button-group.json
Files
lib/reduce-motion.tslib/resize.tslib/run-progress.tslib/highlight.tslib/refs.tscomponents/kino/button-group.tsx
Packages
@base-ui/reactclass-variance-authority

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

ButtonGroup

PropTypeDefaultDescription
orientation'horizontal''vertical''horizontal'A row or a column.
aria-labelstringNoneWhat the buttons are for, such as "Issue actions".

ButtonGroupText

PropTypeDefaultDescription
renderReactElement(props) => ReactElementNoneSwaps the <div> for another element, such as a <label>. See Base UI's useRender (opens in a new tab).

Data attributes

AttributeOnDescription
data-orientationButtonGrouphorizontal or vertical.
data-glidedEach buttonPresent on the button the highlight is under.

Accessibility

  • The group has role="group". Name it with aria-label, so a screen reader says what the buttons are for.
  • Each button keeps its own place in the tab order and its own focus ring, drawn above its neighbours.
  • An icon-only button needs its own aria-label.
  • The highlight is decoration only: it never takes the pointer, and touch doesn’t show it.
  • When the system asks for less motion, the highlight moves straight to the next button instead of gliding.