Chip
A compact token — a filter you toggle, a suggestion you take, or a value you remove.
{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}
A compact token — a filter you toggle, a suggestion you take, or a value you remove.
Import
import { Chip } from "@ir/ui";Variants
| Axis | Options | Default |
|---|---|---|
selected | true · false | — |
Props
| Prop | Type | Required | What it does |
|---|---|---|---|
selected | boolean | Makes the chip a toggle: renders the check and sets aria-pressed. Leave it undefined for a chip that performs an action rather than holding a state — there is nothing to press-and-stay. | |
onRemove | () => void | Makes the chip a removable token — Figma's old Input chip. ⚠️ This changes the element. A chip is a <button> by default, and a button inside a button is invalid HTML that browsers silently unnest, so a removable chip renders as a <span> whose ✕ is the only control. That is also the right semantics: the token is not itself an action. | |
removeLabel | string | Names the ✕ for screen readers. Defaults to "Remove". |
Do and don't
Leave the check on — it is what carries selection.
Don't — Signal that a chip is selected with the fill alone.
On hover, focus and press a selected chip takes the same fill as an unselected one. Remove the check and three of the five states stop telling you anything.
Use selected only for something that stays on; leave it off for a one-shot.
Don't — Set selected on a chip that performs an action.
aria-pressed promises a state that persists. On a chip that just runs a search, it announces a toggle that does not exist.
Let the ✕ be the only control on it.
Don't — Make a removable token clickable as a whole as well.
A button inside a button is invalid HTML, and a token with two overlapping hit areas is a coin toss for anyone using a pointer imprecisely.
Name the subject — "Remove probe-04".
Don't — Ship a row of tokens whose controls are all called "Remove".
A screen reader lists controls out of context. Twelve identical "Remove" buttons is twelve coin tosses.
Use chips for values — filters, tokens, suggestions. Use a Button for a command.
Don't — Reach for a chip because it is a smaller, rounder button.
Chips read as things you are collecting or narrowing by. A verb in a pill just looks like a button that lost an argument with the grid.
Use a Badge when the point is what something is, not what you are filtering by.
Don't — Recolour a chip to carry status.
Chip is deliberately one neutral ramp. Status lives in Badge, which has the tones and the semantics for it.
Accessibility
- A selectable chip sets aria-pressed — it is a toggle button, not a checkbox, so it announces "pressed" rather than "checked".
- The remove button is a separate control with removeLabel as its aria-label: reachable by keyboard without activating the chip itself.
- Disabled sets pointer-events-none on the chip and on its remove button, so neither is clickable while both stay readable.
Where it is drawn
Figma — structure from figma, measurements from figma.