Skip to main content
  1. Docs
  2. Components
  3. Data display

Chip

An interactive tag: one that turns on and off, such as a filter, or a choice already made with a button that removes it.

Import
@qeetrix/react/experimental
Status
ExperimentalSince 0.4.0
Renders
<span role="checkbox">Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

When to use

Use it for
  • Filters over a list: Unread, Mentions, Starred.
  • One or several values from a short set, chosen at once: a status, departments.
  • A choice someone made, shown so it can be taken away: Status: Active ×.
Not for

02

Anatomy

  1. 1chip-group<div>ChipGroup: role="group" of checkboxes with multiple, a radiogroup for one value; named by label.
  2. 2chip<span>A chip, role="checkbox"; chosen, the selected tint and a 2px Ember edge.
  3. 3chip-check<span>The check before the label, so the choice never rests on colour.
  4. 4chip-label<span>The label; a long one wraps.
  5. 5chip-icon<svg>A 16px sharp icon, in the check's place.
  6. 6icon-button<button>"Remove Team: Finance": a small neutral IconButton.

03

Do and don't

A status is a Badge
DoA record's status, read only: a Badge.
Don'tA chip for a status no one can change: it reads as a control.
One value: a group
DoOne of a set: a ChipGroup, its chips radios with one Tab stop.
Don'tLoose chips for one choice: each a checkbox, so two can be on.

04

Sizes

Each height follows the region's density.

SizeHeight: compact / default / comfortableLabel
sm24 / 28 / 32label.sm
md28 / 32 / 36label.md
lg32 / 40 / 44label.md

05

Content

  • One or two words: "Unread", or a filter and its value, "Status: Active".
  • Name the group: label says what's being chosen, "Status". It isn't shown, so put a visible heading beside it where the page needs one.
  • A label that isn't plain text needs removeLabel, so its remove button has a name.
Next — ChipAPI