Code

<!-- pearl-chip.free.js: download it from the Install section below and host it with your site -->
<script src="/pearl-chip.free.js" defer></script>

<pearl-chip label="Filter by topic" mode="filter-multiple" value="design" name="topics" size="34" theme="light">
  <button value="design">Design</button>
  <button value="motion">Motion</button>
  <button value="type">Typography</button>
  <button value="colour">Colour</button>
</pearl-chip>

<script>
  const chips = document.querySelector('pearl-chip');
  chips.addEventListener('change', (e) => console.log(e.detail.value)); // ['design', 'motion']
  chips.addEventListener('remove', (e) => console.log(e.detail.value));
</script>

In context

Mira OkaforJonas WellerAda LindqvistTheo Marchetti
Removable tags
Sunset, one at a time Pro

Install · Free Web Component

One file, no dependencies. Aurora preset, every other option included. Host it yourself so your visitors never load anything from our servers.

1. Install with one command — or download the file
shadcn CLI · React
npx shadcn@latest add https://www.ui-design.co/r/pearl-chip.json
2. Load it and use the element
HTML
<!-- pearl-chip.free.js: download it from the Install section below and host it with your site -->
<script src="/pearl-chip.free.js" defer></script>

<pearl-chip label="Filter by topic" mode="filter-multiple" value="design" name="topics" size="32" theme="light">
  <button value="design">Design</button>
  <button value="motion">Motion</button>
  <button value="type">Typography</button>
  <button value="colour">Colour</button>
</pearl-chip>

<script>
  const chips = document.querySelector('pearl-chip');
  chips.addEventListener('change', (e) => console.log(e.detail.value)); // ['design', 'motion']
  chips.addEventListener('remove', (e) => console.log(e.detail.value));
</script>
3. React + TypeScript (optional)

The shadcn command adds a typed React wrapper for you. Using the file directly? Custom elements work in React as-is; for type checking add:

TypeScript
// pearl-chip.d.ts
declare namespace JSX {
  interface IntrinsicElements {
    'pearl-chip': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
      mode?: 'filter-multiple' | 'filter-single' | 'static';
      value?: string;
      size?: number | string;
      label?: string;
      name?: string;
      theme?: 'light' | 'dark';
      sound?: boolean | '';
    };
  }
}

Pro · React + TypeScript Pro

One payment of $4.99, yours forever. Use it in unlimited personal and commercial projects; no resale.

  • React component (controlled or uncontrolled, icons in chips) with TypeScript types and the full source
  • Sunset, Mint and Mono tints, plus custom tints from Brand Fit
  • The vanilla Web Component with every tint, a demo page, README and license

Attributes & props

NameTypeDefaultDescription
<button> children—One child per chip: its text (or any HTML, e.g. an svg icon) is the label, value="…" the value. selected starts it on, removable adds the × bead, disabled greys it out. After adding buttons from script call el.refresh().
mode 'filter-multiple' | 'filter-single' | 'static''filter-multiple'Any number of chips on, one at most, or plain tags that cannot be selected (set it before the element connects).
value comma-separated string''The selected values. As a property it is a string[]. Fires change with detail.value (string[]).
size number (px)32Chip height; the type, the check and the × scale with it.
label string—Accessible name of the group, e.g. "Filter by topic".
name string—Form field name: one hidden input per selected value goes into the surrounding form.
theme 'light' | 'dark''light'White porcelain or dark.
sound booleanoffA porcelain tap, higher when a chip turns on. Also on for everything inside an element with data-ui-sound="on".
tint Pro'aurora' | 'sunset' | 'mint' | 'mono' | object'aurora'Colours of the light inside a chosen chip, or a custom tint. Free build ships Aurora only.

One element is a whole group (role="group"). Filter chips are toggle buttons with aria-pressed; the group is one Tab stop and the arrows, Home and End move between chips, Space or Enter toggles, Backspace or Delete removes a removable chip. In static mode chips are plain text and only their × buttons take focus. A removed chip collapses first, then remove fires with detail.value and the element drops it; el.removeChip(value) does the same from script. The text stays dark on the light glaze and white on the dark one, so a chosen chip is always readable. All CSS, no WebGL.

More components