Components / Forms
Button Group
Groups related buttons and controls with shared borders.
<div class="btn-group" role="group" aria-label="History">
<button type="button" class="btn" data-variant="outline">Undo</button>
<button type="button" class="btn" data-variant="outline">Redo</button>
</div>Installation
pnpm dlx loseta add button-groupnpx loseta add button-groupExamples
Orientation
<div style="display: flex; align-items: flex-start; gap: 1rem">
<div class="btn-group" role="group" aria-label="Zoom">
<button type="button" class="btn" data-variant="outline" data-size="icon" aria-label="Zoom out"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/></svg></button>
<button type="button" class="btn" data-variant="outline" data-size="icon" aria-label="Zoom in"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/><path d="M12 5v14"/></svg></button>
</div>
<div class="btn-group" role="group" aria-label="Volume" data-orientation="vertical">
<button type="button" class="btn" data-variant="outline" data-size="icon" aria-label="Volume up"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/><path d="M12 5v14"/></svg></button>
<button type="button" class="btn" data-variant="outline" data-size="icon" aria-label="Volume down"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/></svg></button>
</div>
</div>Sizes
<div style="display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem">
<div class="btn-group" role="group" aria-label="Small actions">
<button type="button" class="btn" data-variant="outline" data-size="sm">Small</button>
<button type="button" class="btn" data-variant="outline" data-size="sm">Button</button>
<button type="button" class="btn" data-variant="outline" data-size="icon-sm" aria-label="Add"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/><path d="M12 5v14"/></svg></button>
</div>
<div class="btn-group" role="group" aria-label="Default actions">
<button type="button" class="btn" data-variant="outline">Default</button>
<button type="button" class="btn" data-variant="outline">Button</button>
<button type="button" class="btn" data-variant="outline" data-size="icon" aria-label="Add"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/><path d="M12 5v14"/></svg></button>
</div>
<div class="btn-group" role="group" aria-label="Large actions">
<button type="button" class="btn" data-variant="outline" data-size="lg">Large</button>
<button type="button" class="btn" data-variant="outline" data-size="lg">Button</button>
<button type="button" class="btn" data-variant="outline" data-size="icon-lg" aria-label="Add"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/><path d="M12 5v14"/></svg></button>
</div>
</div>Text
<div class="btn-group" role="group" aria-label="Project URL">
<label class="label" for="demo-button-group-url">https://</label>
<input class="input" id="demo-button-group-url" type="text" placeholder="example.com">
<button type="button" class="btn" data-variant="outline">Copy</button>
</div>Separator
<div class="btn-group" role="group" aria-label="Clipboard">
<button type="button" class="btn" data-variant="secondary">Copy</button>
<hr role="separator" aria-orientation="vertical">
<button type="button" class="btn" data-variant="secondary">Paste</button>
</div>Split
<div class="btn-group" role="group" aria-label="New project">
<button type="button" class="btn" data-variant="secondary">New project</button>
<hr role="separator" aria-orientation="vertical">
<button type="button" class="btn" data-variant="secondary" data-size="icon" aria-label="New project options"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></button>
</div>Input
<div class="btn-group" role="group" aria-label="Search">
<input class="input" type="search" placeholder="Search components..." aria-label="Search components">
<button type="button" class="btn" data-variant="outline" data-size="icon" aria-label="Search"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg></button>
</div>Dropdown menu
<div class="btn-group" role="group" aria-label="Conversation actions">
<button type="button" class="btn" data-variant="outline">Follow</button>
<div class="dropdown-menu">
<button type="button" class="btn" data-variant="outline" data-size="icon" aria-haspopup="menu" aria-expanded="false" aria-label="More conversation actions"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></button>
<div data-popover data-side="bottom" data-align="end" aria-hidden="true" style="width: 11rem">
<div role="menu">
<button type="button" role="menuitem">Mute conversation</button>
<button type="button" role="menuitem">Mark as read</button>
<button type="button" role="menuitem">Report conversation</button>
<div role="separator"></div>
<button type="button" role="menuitem" data-variant="destructive">Delete conversation</button>
</div>
</div>
</div>
</div>Popover
<div class="btn-group" role="group" aria-label="Copilot">
<button type="button" class="btn" data-variant="outline"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-icon="inline-start"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>Copilot</button>
<div class="popover">
<button type="button" class="btn" data-variant="outline" data-size="icon" aria-expanded="false" aria-label="Start a new task"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></button>
<div data-popover data-side="bottom" data-align="end" aria-hidden="true">
<header>
<h3 data-slot="title">Start a new task</h3>
<p data-slot="description">Describe your task in natural language.</p>
</header>
<div class="field">
<label class="label" for="demo-button-group-task">Task</label>
<textarea class="textarea" id="demo-button-group-task" placeholder="I need to..."></textarea>
</div>
</div>
</div>
</div>Select
<div class="btn-group" role="group" aria-label="Send amount">
<div class="btn-group" role="group" aria-label="Amount">
<div class="select">
<button type="button" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="demo-button-group-currency" aria-label="Currency">
<span data-slot="value">$</span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
</button>
<div data-popover data-side="bottom" aria-hidden="true" id="demo-button-group-currency">
<div role="listbox" aria-label="Currency">
<div role="option" aria-selected="true" aria-label="US Dollar">
<span data-slot="text">$</span>
<span data-slot="indicator" aria-hidden="true">✓</span>
</div>
<div role="option" aria-selected="false" aria-label="Euro">
<span data-slot="text">€</span>
<span data-slot="indicator" aria-hidden="true">✓</span>
</div>
<div role="option" aria-selected="false" aria-label="British Pound">
<span data-slot="text">£</span>
<span data-slot="indicator" aria-hidden="true">✓</span>
</div>
</div>
</div>
</div>
<input class="input" type="text" inputmode="decimal" placeholder="10.00" aria-label="Amount">
</div>
<div class="btn-group" role="group" aria-label="Send">
<button type="button" class="btn" data-variant="outline" data-size="icon" aria-label="Send"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg></button>
</div>
</div>Nested
<div class="btn-group" role="group" aria-label="Message composer">
<div class="btn-group" role="group" aria-label="Attachments">
<button type="button" class="btn" data-variant="outline" data-size="icon" aria-label="Add attachment"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/><path d="M12 5v14"/></svg></button>
</div>
<div class="btn-group" role="group" aria-label="Message">
<input class="input" type="text" placeholder="Send a message..." aria-label="Message">
<button type="button" class="btn" data-variant="outline" data-size="icon" aria-label="Send message"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg></button>
</div>
</div>Accessibility and behavior
- Use role="group" with an aria-label on the root. data-orientation="horizontal|vertical" controls the layout; horizontal is the default. Compose buttons, inputs, dropdown-menu, popover or select wrappers, span/label/output text and hr[role="separator"]. Use a toggle-group when the buttons toggle state instead of performing actions.
Files
components/button-group.cssbasestyles/nova/button-group.cssstyleInstall contract
The CLI writes the base file under components/, the visual file for the selected style under styles/<name>/, and any primitive dependency underprimitives/. The generated index.css imports them in the right layer order.