Actions and feedback
Button group
Joined controls that share borders, horizontally or vertically, and a toolbar that spaces groups apart.
Example
Classes
5 classes. Click a name to copy it. Utilities on the same element always win over component defaults, so any of them can be adjusted with plain utility classes.
| Class | Type | What it does |
|---|---|---|
| Part | Part of the button group. On a <div> in the example. Sets inline-flex display, alignment, stacking order, margin, corner radius and border.CSS |
|
| Part | Part of the button group. On a <div> in the example. Sets inline-flex display, alignment, stacking order, margin and corner radius.CSS |
|
| Base | Base class of the button group. On a <div> in the example. Sets inline-flex display, alignment and stacking order.CSS |
|
| Part | Part of the button group. On a <div> in the example. Sets inline-flex display, alignment and stacking order.CSS |
|
| Part | Part of the button group. On a <div> in the example. Sets flex display, alignment and gap.CSS |
Usage
Components ship inside the same stylesheet as the utilities. There is nothing else to install and no script to load: link Monsoon and write the markup.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/monsooncss">
<!-- Button group: start from the base class, then add modifiers -->
<div class="btn-toolbar" role="toolbar" aria-label="Editor">
<div class="btn-group" role="group" aria-label="History">
<button class="btn btn-outline btn-neutral btn-sm">Undo</button>
<button class="btn btn-outline btn-neutral btn-sm">Redo</button>
</div>
<div class="join">
<button class="btn btn-sm">Day</button>
<button class="btn btn-sm btn-active">Week</button>
<button class="btn btn-sm">Month</button>
</div>
<div class="join">
<button class="btn btn-outline btn-neutral btn-sm btn-square" aria-label="Previous"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg></button>
<button class="btn btn-outline btn-neutral btn-sm">Page 2</button>
<button class="btn btn-outline btn-neutral btn-sm btn-square" aria-label="Next"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></button>
<!-- the full example is in the Code tab above -->Theme it with --seed on any ancestor, for example style="--seed: #0d9488", and force a scheme with class="dark" or class="light" on a wrapper.
Accessibility
- Use
buttonfor actions andafor navigation. Icon only buttons need anaria-label; decorative icons carryaria-hidden="true". - Every interactive part shows a visible focus ring with
:focus-visible, and tone colors pair with-foregroundtokens that keep text at 4.5:1 or better in light and dark mode.