Button group Overview

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 items
  • dap-ds-button-group-text – static, non-interactive text inside the group
When to Use

✅ 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-stack with spacing)
Examples Basic

Wrap the buttons in dap-ds-button-group and give the group an accessible name.

Left Center Right
Variants

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).

Archive Report Snooze Archive Report Snooze Archive Report Snooze Delete Delete all
Orientation

Set orientation="vertical" to stack the buttons. Items in a vertical group stretch to the same width.

Zoom in Reset Zoom out
Sizes

The group has no size of its own. Set the same size on every button in the group.

Small Button Group Medium Button Group Large Button Group
Nested groups

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).

1 2 3 Previous Next
Separator

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.

Copy Paste Copy Paste
Split button

Combine a main action with a circle button that opens more options. Give the icon-only button an aria-label.

Save Follow
Text

dap-ds-button-group-text shows a label, a unit or an icon as part of the group. It is not interactive.

Per page 10 25 50
Links and disabled items

Buttons rendered as links (href) and disabled buttons can be grouped like any other button.

Overview Examples Accessibility Undo Redo Clear
Right-to-left

The group uses logical CSS properties, so corners and borders follow the text direction.

First Second Third
Real-World Patterns Editor toolbar

Use role="toolbar" on the outer group when the groups form an application toolbar. The role you set on the host is kept.

Bold Italic Underline Undo Redo
Form footer
Cancel Submit application
Custom Styling

The group is styled through CSS custom properties.

A B C D Copy Paste Filter All Open
Grouping your own elements

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.

Accessibility Requirements
  • Name the group with aria-label or aria-labelledby. The group has role="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.
Keyboard Navigation
  • 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
Screen Reader Support
  • The group's name is announced when focus enters it
  • dap-ds-button-group-separator is decorative and hidden from assistive technology
  • dap-ds-button-group-text is read as plain text
Map zoom
Importing Per-component import (Recommended)

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 everything

Register the whole library at once — convenient, but pulls every component into your bundle:

import 'dap-design-system'
Importing React
import { DapDSButtonGroupReact } from 'dap-design-system/react'
Attributes
PropertyTypeDefaultDescription
orientationButtonGroupOrientation'horizontal'The layout direction of the group
ariaLabelstring, nullnullAccessible label for the element. Use this to provide a text alternative
for elements that don't have visible text content.
ariaExpanded'true', 'false'nullIndicates whether the element is expanded or collapsed.
ariaControlsstring, nullnullIdentifies the element that is controlled by this element.
ariaHasPopupstring, nullnullIndicates the availability and type of interactive popup element.
ariaDescribedBystring, nullnullIdentifies the element that describes the current element.
ariaPressed'true', 'false' , 'mixed'nullIndicates the current "pressed" state of toggle buttons.
ariaHidden'true', 'false'nullIndicates whether the element is hidden from accessibility APIs.
customStylesstring, undefinedCustom 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.
Slots
NameDescription
(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.
Events

No custom events available.

CSS Parts

No CSS parts available.

CSS Custom Properties
Property NameDescription
--dds-button-group-gapSpacing between nested button groups (default: var(--dds-spacing-200))
--dds-button-group-overlapHow much adjacent items overlap so their borders collapse into one (default: var(--dds-border-width-large))
--dds-button-group-start-start-radiusSet 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-radiusSet on grouped items to square off their start-end corner.
--dds-button-group-end-start-radiusSet on grouped items to square off their end-start corner.
--dds-button-group-end-end-radiusSet on grouped items to square off their end-end corner.
How to Use CSS Custom Properties

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.

Components Button Group Separator <dap-ds-button-group-separator/> Attributes
PropertyTypeDefaultDescription
ariaLabelstring, nullnullAccessible label for the element. Use this to provide a text alternative
for elements that don't have visible text content.
ariaExpanded'true', 'false'nullIndicates whether the element is expanded or collapsed.
ariaControlsstring, nullnullIdentifies the element that is controlled by this element.
ariaHasPopupstring, nullnullIndicates the availability and type of interactive popup element.
ariaDescribedBystring, nullnullIdentifies the element that describes the current element.
ariaPressed'true', 'false' , 'mixed'nullIndicates the current "pressed" state of toggle buttons.
ariaHidden'true', 'false'nullIndicates whether the element is hidden from accessibility APIs.
customStylesstring, undefinedCustom 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.
Slots

No slots available.

Events

No custom events available.

CSS Parts

No CSS parts available.

CSS Custom Properties
Property NameDescription
--dds-button-group-separator-colorColor of the separator line (default: var(--dds-border-neutral-divider))
--dds-button-group-separator-sizeThickness of the separator line (default: var(--dds-border-width-base))
Button Group Text <dap-ds-button-group-text/> Attributes
PropertyTypeDefaultDescription
ariaLabelstring, nullnullAccessible label for the element. Use this to provide a text alternative
for elements that don't have visible text content.
ariaExpanded'true', 'false'nullIndicates whether the element is expanded or collapsed.
ariaControlsstring, nullnullIdentifies the element that is controlled by this element.
ariaHasPopupstring, nullnullIndicates the availability and type of interactive popup element.
ariaDescribedBystring, nullnullIdentifies the element that describes the current element.
ariaPressed'true', 'false' , 'mixed'nullIndicates the current "pressed" state of toggle buttons.
ariaHidden'true', 'false'nullIndicates whether the element is hidden from accessibility APIs.
customStylesstring, undefinedCustom 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.
Slots
NameDescription
(default)The text content. Can also hold an icon or a `<label>` for a grouped input.
Events

No custom events available.

CSS Parts
Part NameDescription
baseThe text container.
CSS Custom Properties
Property NameDescription
--dds-button-group-text-backgroundBackground color (default: var(--dds-background-neutral-subtle))
--dds-button-group-text-border-colorBorder color (default: var(--dds-border-neutral-subtle))
--dds-button-group-text-colorText color (default: var(--dds-text-neutral-strong))
--dds-button-group-text-padding-xHorizontal padding (default: var(--dds-spacing-300))
--dds-button-group-text-border-radiusCorner radius outside a group (default: var(--dds-radius-rounded))