Button Group

A container that groups related buttons together with consistent styling.

buridan add button group

Component Guide

Use the following to build the Button_group component.

from components.ui.button_group import button_group

Source Code & Dependencies

For manual installation, copy each of the source codes below in their respective locations.

components/core/core.py

components/ui/separator.py

components/ui/button_group.py

Accessibility

  • button_group.root sets role="group".
  • Use Tab to navigate between the buttons in the group.
  • Use aria-label or aria-labelledby to label the button group.

Examples

Orientation

Set the orientation prop to change the layout.

Props used: orientation on button_group.root.

Size

Control the size of buttons using the size prop on individual buttons.

Props used: size on button.

Separator

button_group.separator visually divides buttons within a group. outline-variant buttons don't need one (they already have a border) — other variants benefit from it for visual hierarchy.

Props used: none required beyond default button_group.separator.

Split

Two buttons separated by a button_group.separator.

Props used: none required beyond default button_group.separator.

Input

Wrap an input with buttons on either side.

Props used: none required — standard button_group.root composition.

A split button group with a menu as the second segment.

Props used: see the Menu docs for menu-specific props.

Select

Pair with a select component.

Props used: see the Select docs for select-specific props.

Error: Reference Target 'button_group_select' not found

API Reference

button_group.root

button_group.root(
    button("Copy", variant="outline"),
    button("Paste", variant="outline"),
)
Prop Type Default
orientation Literal["horizontal", "vertical"] "horizontal"
class_name str ""

button_group.separator

button_group.root(
    button("Bold", variant="ghost"),
    button_group.separator(),
    button("Italic", variant="ghost"),
)
Prop Type Default
orientation Literal["horizontal", "vertical"] "vertical"
class_name str ""

button_group.text

Accepts *children, so any component (including interactive ones) can be rendered as label content inside a group.

button_group.text("Filter by")
Prop Type Default
class_name str ""