Button Group
Related buttons joined into one control. Same markup and props in every style: switch the style in the header to see it change.
Basic
Put any Buttons inside. The corners and borders between them join up in every style.
Split button
A main action with a second button for more options.
Vertical
Stacked buttons, for side panels and narrow toolbars.
Installation
React, Vue and Svelte: add the component to your project with the CLI. It reads your framework from vin.json and also copies any component this one needs. Then import it:
npx @vinish/ui add button-groupimport { ButtonGroup } from "@/components/vin/button-group";import ButtonGroup from "@/components/vin/button-group.vue";import ButtonGroup from "$lib/components/vin/button-group.svelte";The import paths assume the default folders: @/components/vin (React and Vue, with the usual @ → src alias) and $lib/components/vin (SvelteKit). Use your own if you chose another folder in init. How the Vue and Svelte versions pass values and content is in Frameworks.
Plain HTML: the classes come with the style's stylesheet. It needs no JavaScript.
API
From spec/button-group.json, which every framework version is tested against.
| Prop | Values | Default | In HTML |
|---|---|---|---|
orientation | horizontalvertical | horizontal | vin-btn-group--vertical |
aria-labelNames the group for screen readers. | string | — | role="group" aria-label="…" |
Parts
| React, Vue, Svelte | HTML classes |
|---|---|
<ButtonGroup> | .vin-btn-group.vin-btn-group--vertical |
Accessibility
- role="group" with an aria-label tells screen readers the buttons belong together.
- Each button keeps its own label and stays in the Tab order.
- Icon-only buttons in a group still need an aria-label.
- For on/off choices, use Toggle Group instead, so the pressed state is announced.
Customize
Saved in this browser. Style and accent are in the header.