Chip
A compact token that you can act on. It comes in three shapes: a filter that toggles on and off, a value that can be removed, and a tag with a picture at its start. Unlike a badge, which only labels something, a chip is interactive or holds an interactive part.
Couldn't load the demo. Open alone — Filters, removable values and media
<div class="iv-stack iv-u-gap-5">
<fieldset class="iv-stack iv-u-gap-3" style="border: 0; padding: 0; margin: 0">
<legend class="iv-u-text-sm iv-u-font-medium iv-u-mb-2">Filter by stack</legend>
<div class="iv-cluster iv-u-gap-2">
<label class="iv-chip"><input type="checkbox" name="chip-stack" value="html" checked><span>HTML</span></label>
<label class="iv-chip"><input type="checkbox" name="chip-stack" value="css" checked><span>CSS</span></label>
<label class="iv-chip"><input type="checkbox" name="chip-stack" value="astro"><span>Astro</span></label>
<label class="iv-chip"><input type="checkbox" name="chip-stack" value="wordpress"><span>WordPress</span></label>
<label class="iv-chip"><input type="checkbox" name="chip-stack" value="legacy" disabled><span>Legacy</span></label>
</div>
</fieldset>
<div class="iv-cluster iv-u-gap-2" aria-label="Selected cities (sample)">
<span class="iv-chip">Madrid <button class="iv-chip__remove" type="button" aria-label="Remove Madrid"></button></span>
<span class="iv-chip">Lisbon <button class="iv-chip__remove" type="button" aria-label="Remove Lisbon"></button></span>
<span class="iv-chip iv-chip--sm">Porto <button class="iv-chip__remove" type="button" aria-label="Remove Porto"></button></span>
</div>
<div class="iv-cluster iv-u-gap-2">
<span class="iv-chip"><span class="iv-chip__media"><svg viewBox="0 0 24 24" aria-hidden="true"><rect width="24" height="24" fill="#1D4FC4"/><path d="M7 16l5-9 5 9z" fill="#fff"/></svg></span>Design system</span>
<span class="iv-chip">Plain tag</span>
</div>
<p class="iv-u-m-0 iv-u-text-sm iv-u-text-muted">Sample values: the filters filter nothing and the remove buttons remove nothing on this page.</p>
</div>When to use it
- Filter chips narrow a list or a search: stacks, price ranges, tags. Several can be on at once, which is why they are checkboxes. For a single choice use a segmented control.
- Removable chips show values someone has picked — recipients, cities, labels — each with a button that takes it away. Removing it is your code: listen for the click, remove the element and move focus to a sensible neighbour.
- Tags with
iv-chip__mediapair a word with an avatar or an icon: a person, a project, a workspace.
Anatomy
<!-- filter: a checkbox inside the label -->
<label class="iv-chip"><input type="checkbox" name="stack" value="css"><span>CSS</span></label>
<!-- removable value: an empty button draws its own cross -->
<span class="iv-chip">Madrid <button class="iv-chip__remove" type="button" aria-label="Remove Madrid"></button></span>The checkbox stays in the tree and covers the chip, so the whole pill is the click target and the native keyboard and form behaviour stay intact. A checked filter is tinted with its tone and draws a check before the text. A disabled one is dimmed and skipped by the keyboard.
Accessibility
- Group filter chips in a
<fieldset>with a<legend>(“Filter by stack”), so each checkbox is announced with its group. - Every remove button needs a name that says what it removes —
aria-label="Remove Madrid", not “Remove” or “×”. The cross is drawn by CSS and never read. - The remove target is a 24 px circle, the minimum of WCAG 2.5.8, even on the small chip.
- Selected state is never colour alone: the check mark appears with the tint, and forced colours draw it in the system highlight.
Customising
.tags {
--iv-chip-tone: var(--iv-color-accent);
--iv-chip-height: 2.25rem;
}Locals: --iv-chip-tone (the colour of the selected tint and the check, the primary by default) and --iv-chip-height (2rem; iv-chip--sm sets 1.5rem). Padding, the media size and the remove button scale from the height.
Common mistakes
- Using chips for navigation. Links that go somewhere are links; style them as such or use a list.
- A remove button without a specific name.
- Removing a chip without moving focus: keyboard users are left on nothing.
- Mixing filter chips and removable chips in one row: the reader cannot tell which ones toggle.
Class index
Every class of the family. The full list per stylesheet lives in the reference.
| Class | What it does |
|---|---|
iv-chip | The pill: a label with a checkbox, or a span holding a value. |
iv-chip--sm | Small chip, 1.5rem tall. |
iv-chip__media | Avatar or icon at the start, sized to the chip. |
iv-chip__remove | Round remove button at the end; empty, it draws a cross. |