Button Group
Joins related buttons into one strip, in a row or a column.
<arc-button-group>Overview
ButtonGroup joins adjacent buttons into one strip. The inner corners go square, the outer ends keep the buttons' pill shape, and each button still clicks on its own. It works horizontally (the default) or vertically.
Set size and variant on the group and it copies them onto every child button. arc-button has three variants: primary, secondary and ghost.
Guidelines
Do
- Use it for related actions, such as text alignment (Left, Center, Right)
- Keep a group to two to five buttons
- Use the vertical orientation for stacked toolbar controls
- Set size and variant on the group, not on each button
Don't
- Don't use a button group for navigation. Use Tabs or SegmentedControl
- Don't put a destructive action in the same group as other actions unless it looks clearly different
Features
- Items overlap by 1px so neighboring borders don't double up
- The wrapper has `role="group"`
- Takes `arc-button`, `arc-icon-button` or any other slotted element
Preview
Usage
Its events and state need JavaScript, so use the Web Component or a framework wrapper for those.
<arc-button-group>
<arc-button variant="ghost">Left</arc-button>
<arc-button variant="ghost">Center</arc-button>
<arc-button variant="ghost">Right</arc-button>
</arc-button-group>
<!-- Vertical -->
<arc-button-group orientation="vertical" size="sm">
<arc-button variant="ghost">Top</arc-button>
<arc-button variant="ghost">Bottom</arc-button>
</arc-button-group>import { ButtonGroup, Button } from '@arclux/arc-ui-react';
export default function Example() {
return (
<ButtonGroup>
<Button variant="ghost">Left</Button>
<Button variant="ghost">Center</Button>
<Button variant="ghost">Right</Button>
</ButtonGroup>
);
}<script setup>
import { ButtonGroup, Button } from '@arclux/arc-ui-vue';
</script>
<template>
<ButtonGroup>
<Button variant="ghost">Left</Button>
<Button variant="ghost">Center</Button>
<Button variant="ghost">Right</Button>
</ButtonGroup>
</template><script>
import { ButtonGroup, Button } from '@arclux/arc-ui-svelte';
</script>
<ButtonGroup>
<Button variant="ghost">Left</Button>
<Button variant="ghost">Center</Button>
<Button variant="ghost">Right</Button>
</ButtonGroup>import { Component } from '@angular/core';
import { ButtonGroup, Button } from '@arclux/arc-ui-angular';
@Component({
imports: [ButtonGroup, Button],
template: `
<arc-button-group>
<arc-button variant="ghost">Left</arc-button>
<arc-button variant="ghost">Center</arc-button>
<arc-button variant="ghost">Right</arc-button>
</arc-button-group>
`,
})
export class ToolbarComponent {}import { ButtonGroup, Button } from '@arclux/arc-ui-solid';
export default function Example() {
return (
<ButtonGroup>
<Button variant="ghost">Left</Button>
<Button variant="ghost">Center</Button>
<Button variant="ghost">Right</Button>
</ButtonGroup>
);
}import { ButtonGroup, Button } from '@arclux/arc-ui-preact';
export default function Example() {
return (
<ButtonGroup>
<Button variant="ghost">Left</Button>
<Button variant="ghost">Center</Button>
<Button variant="ghost">Right</Button>
</ButtonGroup>
);
}<!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-button-group — requires button-group.css + base.css (or arc-ui.css) -->
<div class="arc-button-group">
<div class="button-group" role="group">
<!-- buttons here -->
</div>
</div><!-- Auto-generated by @arclux/prism — do not edit manually -->
<div style="display: inline-flex">
<div style="display: inline-flex; border-radius: 10px; overflow: hidden;" role="group">
<!-- buttons here -->
</div>
</div>API
variantstring''- Button variant cascaded to all children (e.g., "ghost", "outline").
orientation'horizontal' | 'vertical''horizontal'- Layout direction. Vertical stacks buttons top-to-bottom.
size'sm' | 'md' | 'lg''md'- Size cascaded to all child buttons.
See also
- ButtonAction button with three variants for action hierarchy and prefix and suffix slots for icons. For links, slot a real anchor, which works before JavaScript loads.
- Icon ButtonCompact button that shows an icon, with an optional text label, in ghost, secondary or primary variants.
- ToolbarHorizontal toolbar with prefix, center, and suffix slots.
- Segmented ControlA row of buttons where exactly one is selected, built from arc-option children.