Chip group
Pressable filter pills over native radios or checkboxes, or links. Plain Blade and CSS: no behaviour.
Form control. It takes input in a form, so it is drawn on the Every input type block, beside every other control, as it starts and with an error where it has one.
Anatomy
Status ← legend (or sr-only with hideLabel)
( ✓ Open 12 ) ( Pending 5 ) ( Closed ) ← chips: label > sr-only input + check + icon + words + count
- Group, input mode:
fieldset.min-w-0,legend, then a wrapping flex row of chips. Host attributes land on the fieldset, except the model. - Group, link mode:
nav[aria-labelledby], a labelspan, the same row. - Chip, input mode:
label[data-ds-chip=input], a rounded-full pill, holdinginput.peer.sr-only(radio, or checkbox postingname[]), the check cell, the optional icon (micro), the words, the optional count. - Chip, link mode:
a[data-ds-chip=link]with the same children; nohrefwhen disabled. - Check cell:
overflow-hidden,w-0, opening to the icon's width plus a 4px gap (w-5;w-4.5at sm) when chosen.
How the group reaches the chips
A component's slot renders before the component's own view, so the group cannot pass data down after the fact.
name,multipleandsizereach the chips through@aware.- The group reads the rendered slot: the
data-ds-chipmarkers tell it which mode it is in, and it throws when both are present. - Each input carries a
data-ds-chip-inputhook, which the group replaces with the host'swire:model*/x-model*attributes (or nothing), so the binding lands on every input and the hook never reaches the page.
States
| State | Treatment |
|---|---|
| resting | border-border bg-surface text-fg-body |
| hover | border-fg/20 bg-surface-subtle |
| chosen | border-accent bg-accent-tint text-on-accent-tint, check open |
| focus-visible | outline-2 outline-offset-2 outline-focus-ring on the pill (has-focus-visible: for inputs) |
| disabled | bg-surface-subtle text-fg-muted (the muted text of a disabled radio or checkbox label), cursor-not-allowed; chosen and disabled adds border-border-strong, check still open |
| link active | the chosen look, written out; aria-current="true" |
The colour change is motion-safe:transition-colors, the check
motion-safe:transition-[width], both duration-popover-enter ease-enter.
Sizes
| Size | Height | Padding | Text | Icons |
|---|---|---|---|---|
| sm | 28px | px-2.5 | text-meta | 14px |
| md | 32px | px-3 | text-meta | 16px |
| lg | 40px | px-4 | text-body | 16px |
Choices and why
- Pills, not a segmented control. They wrap, each stands alone, and the same look serves one-of and any-of.
- The input is
sr-only, nothidden. It keeps focus, arrow keys and validation; the label carries the look throughhas-checked:. - Mixing modes throws rather than rendering a group half of which posts and half of which navigates.
labelis required, visible by default;hideLabelkeeps it as the name only.
Accessibility
| Role | group (fieldset) of radios or checkboxes; or navigation of links |
| Name | The legend, or the nav's label; each chip its words and count |
| State | Native checked; aria-current="true" on the active link; aria-disabled on a disabled link |
| Keyboard | Radios: arrows move and choose, skipping disabled. Checkboxes: Tab and Space. Links: Tab and Enter |
| Focus | Ring on the pill |
| Not colour alone | The check |
| Motion | Width and colour transitions, motion-safe only |
Help and error
Since batch 30B, help and error in the one field pattern every control
shares (partials/field-message, the markup ds::input draws): the help as
muted meta text, or in its place the error with its icon in the danger
colour, never both. The message's id ({id}-help, {id}-error) is named by
the control's aria-describedby, after anything the host passed. With
neither prop the control renders exactly as before
(tests/FieldMessagesUnchangedTest.php).
The label is drawn in the field label's style (text-body font-medium text-fg, mb-1.5) since 30B, as every other control's; it was smaller and muted (text-meta text-fg-muted, mb-2). The message describes the fieldset or nav.
Do not
- Do not use for actions. That is a button.
- Do not add script. The inputs are the state.
- Do not put the binding on the chips one by one when the group can carry it; they would drift.
From the package repo: edit this page on GitHub.