About this set
Three ways to join buttons into one control. An attached horizontal group picks a view density, Comfortable, Cosy or Compact. A formatting toolbar holds two groups of icon buttons, bold, italic and underline, then left, centre and right alignment, separated by a thin rule. A vertical stack picks a sort order, Newest first, Most popular or Price, low to high. Every button is a toggle with aria-pressed, and a short script keeps the state honest: groups marked data-toggle-group=”single” press the clicked button and release the rest, while the text style group is marked multiple, so bold, italic and underline switch on and off independently. The toolbar follows the ARIA toolbar pattern: it is one Tab stop, and the Left and Right arrow keys, Home and End move focus between its six buttons. Pressed buttons turn near-black in the attached groups and pale indigo in the toolbar. Use attached groups for mutually exclusive view options and the toolbar for editor controls. The Bootstrap version uses .btn-group, .btn-toolbar and .btn-group-vertical, and the Tailwind version uses aria-pressed variants with first: and last: for the rounded ends.
What’s included
- Attached horizontal group, icon toolbar and vertical stack
- Toggle state kept in aria-pressed and styled from it
- Single-choice and multiple-choice group behaviour
- Toolbar arrow-key navigation with one Tab stop
- Borders darkened to 3:1 against the page
Accessibility
Each group has role="group" and an aria-label, the toolbar has role="toolbar", and every icon button has an aria-label with its SVG hidden. Pressed state is exposed through aria-pressed. Inside the toolbar, Left and Right arrows, Home and End move focus and Tab leaves it. Keyboard focus draws a 2px indigo outline above neighbouring buttons, and colour transitions are removed under prefers-reduced-motion.
Customise it
Change the border #838b9b and the pressed colours in the .grp button[aria-pressed=true] and .grp-bar rules. In Bootstrap edit the --bs-btn-border-color and --bs-btn-bg variables on .grp .btn and its [aria-pressed=true] rule; in Tailwind edit the border-, aria-pressed:bg- and aria-pressed:text- utilities.

















