Button group
Join related buttons into one segmented bar.
SourceStyles source@monoline/react 0.5.0Markdown for AI toolsstable
- Built on native elements
- role="group" with a required accessible name.
- Styles in one file:
02-buttons.css
Import
import '@monoline/css';
import {ButtonGroup} from '@monoline/react';
Not installed yet? Pick a route.
Copies the source and its styles into your project.
npx monoline add button-group
Usage
import {Button, ButtonGroup} from '@monoline/react';
<ButtonGroup aria-label="View">
<Button variant="line">Day</Button>
<Button variant="line">Week</Button>
<Button variant="line">Month</Button>
</ButtonGroup>
Examples
Basic
Props
ButtonGroupProps
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label required | string | – | Names the group for assistive tech, for example "Text alignment". |
Data Attributes
State is exposed through attributes. Style it with these selectors, not with class toggles.
This component sets no state attributes.
CSS classes
| Class | Stylesheet |
|---|---|
.btn | 02-buttons.css |
.btn-block | 02-buttons.css |
.btn-danger | 02-buttons.css |
.btn-ghost | 02-buttons.css |
.btn-lg | 02-buttons.css |
.btn-line | 02-buttons.css |
.btn-sm | 02-buttons.css |
.btn-solid | 02-buttons.css |
.btn | button-group.css |
.btn-group | button-group.css |
Customization
Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.
app.css
.btn {
border-color: var(--accent);
}
Accessibility
- role="group" with a required accessible name.