Headless button toggle
Installation
Import the group and item primitives together so keyboard and selection behavior stay aligned.
Primitive imports
ts
import { TngButtonToggle, TngButtonToggleGroup } from '@tailng-ui/primitives';
Basic usage
Single-select groups use valueChange; multiple groups use valuesChange.
Single-select group
html
<div
tngButtonToggleGroup
type="single"
[tngButtonToggleValue]="density()"
(valueChange)="onDensityChange($event)"
>
<button tngButtonToggle tngButtonToggleValue="compact">Compact</button>
<button tngButtonToggle tngButtonToggleValue="comfortable">Comfortable</button>
<button tngButtonToggle tngButtonToggleValue="spacious">Spacious</button>
</div>
Multiple-select group
html
<div
tngButtonToggleGroup
type="multiple"
[tngButtonToggleValues]="filters()"
(valuesChange)="onFiltersChange($event)"
>
<button tngButtonToggle tngButtonToggleValue="a11y">Accessibility</button>
<button tngButtonToggle tngButtonToggleValue="signals">Signals</button>
<button tngButtonToggle tngButtonToggleValue="dx">DX</button>
</div>
Style variants
The same headless interaction contract can sit inside a simple plain CSS shell or a Tailwind utility shell.