The button group joins related buttons into one connected control. Inside a group the inner corners of the buttons are squared off and the borders of neighbouring buttons collapse into a single line, so the set reads as one unit while every button stays a separate, focusable action.
The group works with dap-ds-button (including circle buttons), dap-ds-icon-button, and two helper elements:
dap-ds-button-group-separator– a divider line between itemsdap-ds-button-group-text– static, non-interactive text inside the group
✅ Use a button group when:
- Several actions belong together (alignment, zoom, pagination, clipboard)
- You need a split button: a main action plus a menu trigger
- A short label or unit should sit attached to a set of buttons
❌ Don't use a button group for:
- Picking one option from a set (use the content switcher or radio buttons)
- Toggling a single on/off state (use a toggle button or a switch)
- Unrelated actions that only happen to sit next to each other (use a
dap-ds-stackwith spacing)
Wrap the buttons in dap-ds-button-group and give the group an accessible name.
Every button variant can be grouped. Outline and subtle buttons have their own border, so the shared border marks the boundary. Primary buttons have no border, so add a separator between them (see below).
Set orientation="vertical" to stack the buttons. Items in a vertical group stretch to the same width.
The group has no size of its own. Set the same size on every button in the group.
Put button groups inside a button group to build toolbars. Nested groups are not joined to each other; they are separated by a gap (--dds-button-group-gap).
dap-ds-button-group-separator draws a line between two items. It turns horizontal by itself in a vertical group. Use it with filled variants such as primary; outline buttons don't need one.
Combine a main action with a circle button that opens more options. Give the icon-only button an aria-label.
dap-ds-button-group-text shows a label, a unit or an icon as part of the group. It is not interactive.
Buttons rendered as links (href) and disabled buttons can be grouped like any other button.
The group uses logical CSS properties, so corners and borders follow the text direction.
Use role="toolbar" on the outer group when the groups form an application toolbar. The role you set on the host is kept.
The group is styled through CSS custom properties.
The group squares off corners by setting four custom properties on each item: --dds-button-group-start-start-radius, --dds-button-group-start-end-radius, --dds-button-group-end-start-radius and --dds-button-group-end-end-radius. They inherit, so a button wrapped in another element (for example a dropdown trigger) still picks them up. To make a custom element join a group, use them for its corners with your own radius as the fallback:
.my-group-item {
border-start-start-radius: var(--dds-button-group-start-start-radius, 8px);
border-start-end-radius: var(--dds-button-group-start-end-radius, 8px);
border-end-start-radius: var(--dds-button-group-end-start-radius, 8px);
border-end-end-radius: var(--dds-button-group-end-end-radius, 8px);
}
Items overlap by --dds-button-group-overlap (the button border width by default) so neighbouring borders merge into one line. The group sets these margins with !important, because the reset stylesheet (dds-reset.css) zeroes every element's margin. Don't set your own margins on grouped items.
- Name the group with
aria-labeloraria-labelledby. The group hasrole="group"by default. - Icon-only buttons inside the group need their own
aria-label. - Toolbars: set
role="toolbar"on the group when it acts as an application toolbar.
- Tab / Shift+Tab: moves between the buttons of the group, one by one
- Space / Enter: activates the focused button
- The focused or hovered button is drawn above its neighbours, so its focus ring is never cut off
- The group's name is announced when focus enters it
dap-ds-button-group-separatoris decorative and hidden from assistive technologydap-ds-button-group-textis read as plain text
Import the component by its own subpath. This registers <dap-ds-button-group> (and the
components it renders internally) and lets your bundler include only what you use:
import 'dap-design-system/components/button-group'
Need a reference to the class (e.g. to register it manually or extend it)? The same subpath default-exports it:
import DapDSButtonGroup from 'dap-design-system/components/button-group'
Register the whole library at once — convenient, but pulls every component into your bundle:
import 'dap-design-system'
import { DapDSButtonGroupReact } from 'dap-design-system/react'
| Property | Type | Default | Description |
|---|---|---|---|
orientation | ButtonGroupOrientation | 'horizontal' | The layout direction of the group |
ariaLabel | string, null | null | Accessible label for the element. Use this to provide a text alternative |
| for elements that don't have visible text content. | |||
ariaExpanded | 'true', 'false' | null | Indicates whether the element is expanded or collapsed. |
ariaControls | string, null | null | Identifies the element that is controlled by this element. |
ariaHasPopup | string, null | null | Indicates the availability and type of interactive popup element. |
ariaDescribedBy | string, null | null | Identifies the element that describes the current element. |
ariaPressed | 'true', 'false' , 'mixed' | null | Indicates the current "pressed" state of toggle buttons. |
ariaHidden | 'true', 'false' | null | Indicates whether the element is hidden from accessibility APIs. |
customStyles | string, undefined | Custom CSS text to be merged with the component's styles. | |
| This CSS will be injected into the shadow DOM and merged with the component's static styles. |
| Name | Description |
|---|---|
(default) | The grouped items: `dap-ds-button`, `dap-ds-icon-button`, `dap-ds-button-group-text`, `dap-ds-button-group-separator` or nested `dap-ds-button-group` elements. |
No custom events available.
No CSS parts available.
| Property Name | Description |
|---|---|
--dds-button-group-gap | Spacing between nested button groups (default: var(--dds-spacing-200)) |
--dds-button-group-overlap | How much adjacent items overlap so their borders collapse into one (default: var(--dds-border-width-large)) |
--dds-button-group-start-start-radius | Set on grouped items to square off their start-start corner. Read by `dap-ds-button`, `dap-ds-icon-button` and `dap-ds-button-group-text`. |
--dds-button-group-start-end-radius | Set on grouped items to square off their start-end corner. |
--dds-button-group-end-start-radius | Set on grouped items to square off their end-start corner. |
--dds-button-group-end-end-radius | Set on grouped items to square off their end-end corner. |
CSS custom properties (CSS variables) can be set directly on the component or in your stylesheet:
Method 1: Inline styles (Quick customization)
<dap-ds-button-group
style="--dds-button-group-gap: value; --dds-button-group-overlap: value;">
Button group
</dap-ds-button-group>
Method 2: CSS classes (Reusable styles)
.my-custom-dap-ds-button-group {
--dds-button-group-gap: value;
--dds-button-group-overlap: value;
--dds-button-group-start-start-radius: value;
}
<dap-ds-button-group class="my-custom-dap-ds-button-group">
Button group
</dap-ds-button-group>
Method 3: Global theme customization
/* Apply to all instances */
dap-ds-button-group {
--dds-button-group-gap: value;
--dds-button-group-overlap: value;
}
CSS custom properties inherit through the Shadow DOM, making them perfect for theming. Changes apply immediately without rebuilding.
| Property | Type | Default | Description |
|---|---|---|---|
ariaLabel | string, null | null | Accessible label for the element. Use this to provide a text alternative |
| for elements that don't have visible text content. | |||
ariaExpanded | 'true', 'false' | null | Indicates whether the element is expanded or collapsed. |
ariaControls | string, null | null | Identifies the element that is controlled by this element. |
ariaHasPopup | string, null | null | Indicates the availability and type of interactive popup element. |
ariaDescribedBy | string, null | null | Identifies the element that describes the current element. |
ariaPressed | 'true', 'false' , 'mixed' | null | Indicates the current "pressed" state of toggle buttons. |
ariaHidden | 'true', 'false' | null | Indicates whether the element is hidden from accessibility APIs. |
customStyles | string, undefined | Custom CSS text to be merged with the component's styles. | |
| This CSS will be injected into the shadow DOM and merged with the component's static styles. |
No slots available.
No custom events available.
No CSS parts available.
| Property Name | Description |
|---|---|
--dds-button-group-separator-color | Color of the separator line (default: var(--dds-border-neutral-divider)) |
--dds-button-group-separator-size | Thickness of the separator line (default: var(--dds-border-width-base)) |
| Property | Type | Default | Description |
|---|---|---|---|
ariaLabel | string, null | null | Accessible label for the element. Use this to provide a text alternative |
| for elements that don't have visible text content. | |||
ariaExpanded | 'true', 'false' | null | Indicates whether the element is expanded or collapsed. |
ariaControls | string, null | null | Identifies the element that is controlled by this element. |
ariaHasPopup | string, null | null | Indicates the availability and type of interactive popup element. |
ariaDescribedBy | string, null | null | Identifies the element that describes the current element. |
ariaPressed | 'true', 'false' , 'mixed' | null | Indicates the current "pressed" state of toggle buttons. |
ariaHidden | 'true', 'false' | null | Indicates whether the element is hidden from accessibility APIs. |
customStyles | string, undefined | Custom CSS text to be merged with the component's styles. | |
| This CSS will be injected into the shadow DOM and merged with the component's static styles. |
| Name | Description |
|---|---|
(default) | The text content. Can also hold an icon or a `<label>` for a grouped input. |
No custom events available.
| Part Name | Description |
|---|---|
base | The text container. |
| Property Name | Description |
|---|---|
--dds-button-group-text-background | Background color (default: var(--dds-background-neutral-subtle)) |
--dds-button-group-text-border-color | Border color (default: var(--dds-border-neutral-subtle)) |
--dds-button-group-text-color | Text color (default: var(--dds-text-neutral-strong)) |
--dds-button-group-text-padding-x | Horizontal padding (default: var(--dds-spacing-300)) |
--dds-button-group-text-border-radius | Corner radius outside a group (default: var(--dds-radius-rounded)) |