Button Group
A container that groups related buttons together with consistent styling.
Installation
Command to install the Button Group component.
Component Guide
Use the following to build the Button Group component.
from components.ui.button_group import button_groupSource 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.rootsetsrole="group".- Use
Tabto navigate between the buttons in the group. - Use
aria-labeloraria-labelledbyto 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.
Dropdown Menu
A split button group with a menu as the second segment.
Props used: see the Menu docs for menu-specific props.
API Reference
button_group.root
button_group.root(
button("Copy", variant="outline"),
button("Paste", variant="outline"),
)
button_group.separator
button_group.root(
button("Bold", variant="ghost"),
button_group.separator(),
button("Italic", variant="ghost"),
)
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")