Components / forms

Chip

A small control the reader turns on and off, or takes away — a filter, a selected tag.

Rendered from the package · open on its own

Summary

A small control the reader turns on and off, or takes away — a filter, a selected tag.

APG patternButton
Built onnative elements
Statusself-tested
Since0.7.0
<Chip pressed={filters.has('live')} onPressedChange={(on) => toggle('live', on)}>Live</Chip>
<Chip onDismiss={() => remove('Design')} dismissLabel="Remove Design">Design</Chip>
<Chip pressed onPressedChange={set} onDismiss={clear} dismissLabel="Remove Open">Open</Chip>

A chip toggles, or can be removed, or both. Without either it is a Badge.

Anatomy

A <span data-se="chip" data-se-text="ui"> that draws the pill — the type role is part of the anatomy, as Button's is. Inside it, the words sit in control — a <button> carrying aria-pressed — when the chip toggles, and in label when it does not. A removable chip adds close, a second <button> with one job. Two buttons side by side is why the root is a span: a button cannot hold a button.

PartElementRequired
close<button>no
control<button>yes
label<span>yes
<span data-se="chip" data-se-text="ui">
  <button type="button" data-part="control" aria-pressed="true">Live</button>
</span>

<span data-se="chip" data-se-text="ui">
  <span data-part="label">Design</span>
  <button type="button" data-part="close" aria-label="Remove Design">
    <svg aria-hidden="true">…</svg>
  </button>
</span>

One of control and label is always present; the binding picks by whether onPressedChange was passed.

Properties

PropertyValuesDefaultWhat it does
pressedbooleanfalseWhether the chip is on. Written to aria-pressed on control, so the state reaches the screen reader and the CSS from one attribute.
onPressedChange(pressed: boolean) => voidnoneCalled with the next value when the reader toggles it. Passing it is what makes the words a button; without it the chip does not toggle and the words are plain.
onDismiss() => voidnoneAdds the close button. The chip does not remove itself — the caller owns the list it sits in, and removing from a list the component cannot see is how a chip and its data disagree.
dismissLabelstringRemoveThe close button's accessible name. Say what is removed — Remove Design — because a row of close buttons all named Remove is a row a screen reader cannot tell apart.
disabledbooleannoneNot usable, not focusable. Both buttons take disabled; the root takes data-disabled, because a span is not a form control.
childrenReact.ReactNodenoneThe words. A chip is one short label; it has no icon slots, and a count beside the words is text.

No intent. Pressed is the chip's one color, and a second color on a toggle says two things with one channel — the same ruling Carousel's dots took in 0.6. A state worth a color is a Badge beside the chip, not the chip.

States

StateExpressed as
Disabled:disabled
Focused:focus-visible
Hover:hover
Pressedaria-pressed
Disableddata-disabled

aria-pressed is written as true or false whenever the chip toggles, never absent-for-false: a toggle button whose attribute comes and goes reads as two different controls to a screen reader.

Behavior

Activating control calls onPressedChange with the opposite of pressed. Activating close calls onDismiss. Neither changes anything on its own; the caller re-renders with the new state, and a chip whose caller ignores the call stays where it was. A disabled chip answers neither.

Accessibility

A toggle is a button with aria-pressed, from the APG. Not a checkbox: a checkbox submits a value, a toggle changes the page now. The platform gives the button its role, its name and its keys.

Two controls, two names. The close button cannot share the toggle's name, so it takes dismissLabel as an aria-label, and the caller is asked to name the thing removed.

Removal moves focus, and that is the caller's job. When a chip is removed, focus is on an element that no longer exists. The caller moves it — to the next chip, or to the input the chips belong to. The component cannot know which, and must not guess.

Keyboard

KeyResult
Enter, SpaceToggles control, or activates close, from the platform. Nothing here re-implements them.

Delete and Backspace do not remove a chip. That contract belongs to the tag input — Combobox choosing several, which is built on this component — where the input owns the keys.

Roles, states and properties

AttributeSet by
aria-hiddenalways true
aria-labelset at render
aria-pressedset at render

Focus

Each button is a normal tab stop; a chip with both has two. Focus stays on control after a toggle. After a removal there is nothing to stay on — see above.

Screen reader

Not recorded as verified. Stage 4 of the readiness ladder — driving each component with VoiceOver and NVDA — is unstarted across the package, and no component should claim otherwise until docs/journal/ records the session that did it.

Contrast and target size

npm run check:contrast audits every color pair this component uses across all four skins, light and dark, and fails the build on a shortfall. Two waivers are on the record in docs/audit/DEFERRED.md.

It takes the touch floor under (pointer: coarse) — the visual size is unchanged on a desktop pointer.

Tested

  • test/apg/badge-chip.test.jsx
  • test/apg/client-boundary.test.jsx
  • test/browser/badge-chip.spec.mjs

Known gaps

_No upstream requirement is recorded as not applicable._

Appearance

A pill at the small control height, the ui type role inside, a hairline border. Pressed takes the soft accent fill with an accent border and accent text — the one state that changes its color. Hover darkens the border; disabled takes the sunk surface and the disabled text. The buttons inside draw nothing of their own: the pill is the root's, and the focus ring is drawn on the root through :has(:focus-visible) so it surrounds the whole chip rather than one of its two halves.

TokenUsed for
--se-accentborder-color
--se-accent-softbackground
--se-accent-textcolor
--se-borderborder-color
--se-border-hoverborder-color
--se-border-strongborder
--se-border-widthborder
--se-control-h-smblock-size
--se-duration-instanttransition
--se-ease-standardtransition
--se-focus-coloroutline
--se-focus-offsetoutline-offset
--se-focus-widthoutline
--se-icon-smblock-size, inline-size
--se-radius-pillborder-radius
--se-space-2padding-inline
--se-space-3padding
--se-surfacebackground
--se-surface-sunkbackground
--se-target-minmin-block-size
--se-textcolor
--se-text-disabledcolor
--se-text-mutedcolor

Motion

Background and border color cross --se-duration-instant on toggle and hover. Nothing moves. A chip that is removed leaves at once; the list it sat in may animate the gap closing, and that is the list's decision.

Content

One or two words, sentence case, the noun the reader chose. Design, Live, Last 30 days. A chip that reads as a sentence is doing a Button's job.

The close name says what goes. Remove Design, not Remove and not ×.

Usage

Chip acts; Badge names. A thing the reader cannot change is a Badge. The builder's .cc-chip was both — forty-four uses in nine files, a handful of them pressable — and the split is the point of having two components.

A set of filters is a set of chips, each its own toggle. Chips in a row are not a radio group: several can be on at once, and that is what makes them chips. If exactly one must be on, use Tabs or a SegmentedControl.

A removable chip is a value, not a filter. It means this is chosen, and taking it away unchooses it. The tag input is the usual home, and it owns the keys.

When not to use it. For an action — Publish, Delete — use a Button; a chip's shape promises a state, not an outcome. For a state the reader only reads, Badge.

Notes

Split from Badge on 15 Oct 2026 (both plans). Three apps had one class doing both jobs. The toggle got the name Chip; the dot went to Badge as its status part.

The root is a span because a button cannot contain a button. A removable toggle needs two controls, and the only valid way to draw one pill around two buttons is to draw it on a parent. The cost is that the focus ring is drawn through :has(), which the contract already relies on for Card.

control and label are alternatives, not a pair. The words are a button only when they can be pressed. Rendering a <button> that does nothing would give a screen reader a control with no effect.

No intent axis — recorded under Properties. The evidence was a filter row in the builder that colored each chip by the status it filtered; the review read it as a Badge's color on a Chip's job, and the two components answer it apart.