Components/Actions/Button Group
COMPONENT04.04

Button Group

Buttons, selects, inputs and dropdown triggers joined into one segmented control with shared hairlines.


INSTALL

1pnpm dlx @sayagodev/mo add button-group

Or import the files from the package (no copy):

1import "@sayagodev/mo/css/button-group.css";

EXAMPLES

Demo


Orientation
Sizes
Nested
Separator & split


With dropdown

Snooze

With select
With input
Text segment
Production
Environment
Popover
Start a new task with Copilot

Describe your task in natural language.

Copilot will open a pull request for review.

USAGE

1<div role="group" data-button-group>2  <button class="outline">Day</button>3  <button class="outline">Month</button>4  <hr data-separator />5  <span data-button-group-text>2026</span>6</div>

API

NAMEKINDDESCRIPTION
[data-button-group]attributeSelects the component on any wrapper
data-orientationattributevertical stacks the join on the block axis
hr[data-separator]element1px divider between segments
[data-button-group-text]attributeMuted bordered label segment
--mo-button-group-*tokenGap/divider hooks

FILES

src/css/button-group.css
Install:mo add button-group

THEMING · PLAYGROUND

This is the exact component from the examples above, wearing a completely different theme. Edit the tokens and --mo-* hooks in the editor — autocomplete knows them all — and the preview obeys in real time. Your CSS always wins.

Tokens & hooks — edit live
Global tokens
--border--foreground--input--muted--muted-foreground--radius
Component hooks
--mo-button-group-divider--mo-button-group-gap--mo-button-group-text-padding-x--mo-button-radius

Preview

Your CSS

Try it: type --mo- for the component hooks, or edit any value — the preview obeys in real time.