Fair Case

Chip

A pill holding an icon and a short label. inline sits inside a field with no ring; outlined stands on its own with a 1px rule ring. The label is a control's, so it takes the link role (weight 500, -0.03em) like the header's links.

Variants and sizes

Outlined stands alone with a rule ring; inline sits in a field with none. Size owns height and padding.

Sample place
outlined
Sample language
outlined
Inline chip
inline
touch · 44
icon · 44
bar · 44

TSX

// Chip: a pill with an icon and a short label, such as a place or a language.
// outlined stands on its own with a rule ring; inline (the default) sits
// inside a field. A chip that opens something is a trigger, so it puts
// chipVariants on a <button> (or a Base UI trigger) instead of rendering
// <Chip>.
import { Chip, chipVariants } from "@repo/ui/chip";
import { GlobeIcon, PinIcon } from "@repo/ui/icons";

export default function ChipVariants() {
  return (
    <>
      <Chip variant="outlined">
        <PinIcon />
        Sample place
      </Chip>
      <Chip variant="outlined">
        <GlobeIcon />
        Sample language
      </Chip>
      <Chip>
        <PinIcon />
        Inline chip
      </Chip>
      {/* size owns height and padding: touch, icon and bar are all 44px. */}
      <button
        type="button"
        className={chipVariants({ size: "touch", interactive: true })}
      >
        <PinIcon />
        Touch
      </button>
      {/* An icon-only chip needs its name in aria-label. */}
      <button
        type="button"
        aria-label="Sample language"
        className={chipVariants({ size: "icon", interactive: true })}
      >
        <GlobeIcon />
      </button>
      {/* fill="track" is the chip inside the composer bar. */}
      <button
        type="button"
        className={chipVariants({
          size: "bar",
          interactive: true,
          fill: "track",
        })}
      >
        <PinIcon />
        Composer bar
      </button>
    </>
  );
}

Interactive tones

A chip that is itself a trigger takes a tone on hover, press and while its popup is open. A press tones at once.

rest
hover, pressed, open
fill track, hover

TSX

// An interactive chip: one that is itself a trigger. interactive: true adds
// the hover, press and open tones (open while its popup is showing). A press
// tones at once. fill="track" takes the track tone instead, for the composer
// bar. The tones come from the classes; write none of your own.
import { chipVariants } from "@repo/ui/chip";
import { PinIcon } from "@repo/ui/icons";

export default function ChipTones() {
  return (
    <>
      <button type="button" className={chipVariants({ interactive: true })}>
        <PinIcon />
        Interactive
      </button>
      <button
        type="button"
        className={chipVariants({
          size: "bar",
          interactive: true,
          fill: "track",
        })}
      >
        <PinIcon />
        Composer bar
      </button>
    </>
  );
}

Label variant

Not written yet

A label variant for topic labels has been proposed. chip.tsx has only inline and outlined, so there is nothing to show until it is built.

Code

TSX

// Chip in use: a standing chip, and the same look on a trigger. Triggers (the
// footer's language chip, the Ask bar's location chip) put chipVariants on a
// button or a Base UI trigger instead of rendering <Chip>, since <Chip> is a
// plain span.
import { Chip, chipVariants } from "@repo/ui/chip";
import { PinIcon } from "@repo/ui/icons";

export default function ChipUsage() {
  return (
    <>
      <Chip variant="outlined">
        <PinIcon />
        Sample place
      </Chip>
      <button
        type="button"
        className={chipVariants({ size: "touch", interactive: true })}
      >
        <PinIcon />
        Touch
      </button>
    </>
  );
}

Triggers (the footer's language chip, the Ask bar's location chip) put chipVariants({ ... }) on a button or a Base UI trigger instead of rendering <Chip>.

Variants

Variants
PropValueHow it looks
variantinlineNo fill, no ring. Text 16/24, weight 500, -0.03em (the link role). Default size has 4px side and 8px top and bottom padding.
variantoutlinedRaised fill (#FAFDFF light, #00172E dark), 1px rule ring (#B2D5FF light, #23446A dark), text 14/21 weight 500. Default size is 36px tall with 12px side padding.
basesharedInline flex, full pill (rounded-full), 6px gap between icon and label, text colour, no wrapping, never shrinks.
sizedefaultEach variant's own height and padding (see above).
sizetouch44px tall. Inline: 6px side padding. Outlined: 12px side padding.
sizebar44px tall, no vertical padding, 14px padding at the start and 16px at the end: the composer's wider inline padding.
sizetouch-bartouch (44px, same padding) below 768px; from 768px it becomes bar's 14px start and 16px end padding.
sizeicon44px square, content centred, no padding, holds only an icon. Needs an aria-label.
interactivetrueTones on the chip itself: hover, active (press) and data-popup-open. Eases over 300ms; a press tones at once (0ms).
interactivegroupSame tones driven by a parent with the group class (group-hover, group-active, group-data-popup-open), plus a 2px focus outline at a 2px offset on group-focus-visible.
fillhoverTone is the tint fill (#EEF6FF light, #122A43 dark).
filltrackTone is the track fill (ink 14% light, ground 18% dark).

States

States
StateHow it looks
restNo tone. A plain chip is not interactive and has no hover.
hoverinteractive only: the fill tone behind the pill.
pressedinteractive only: the same tone, shown at once (no easing) so a tap shows before a menu opens on release.
openinteractive only: data-popup-open keeps the tone while its popup is open.
focustrue: the global 2px focus ring. group: the chip draws the ring itself because the parent hides its own.
disablednot written
label variantnot written. A third variant for topic labels is proposed and is not in the code.

Props

Import from @repo/ui/chip.

Props
PropTypeDefaultWhat it does
variant"inline" | "outlined"default "inline"inline: no ring, sits inside a field. outlined: stands alone with a 1px rule ring.
size"default" | "touch" | "bar" | "touch-bar" | "icon"default "default"Owns height and padding, so a call site never overrides them.
interactivefalse | true | "group"default falsetrue adds hover, press and open tones for a chip that is itself the trigger. "group" does the same when the trigger is a parent with the group class, and draws the focus ring the parent hides.
fill"hover" | "track"default "hover"The colour of those tones. track is for the composer's chips.
...restComponentProps<"span">A <span>. className is merged with cn().
chipVariantscva functionExported so a button or trigger can wear the same classes.

Use it well

  • size owns height and padding. Do not override them at a call site.

  • An interactive chip is a trigger's look, so put chipVariants on a button, not <Chip> on a span.

  • Use interactive="group" when a larger hit area (a parent with the group class) is the real trigger.

  • Use fill="track" inside the Ask bar and composer, whose fills are the track's.

  • An icon-size chip has no text, so give its button an aria-label.

  • Join's area chips add a checked look in the caller: hover fill and a 1.5px accent ring (peer-checked), with a check icon.

  • A label variant is proposed and is not in the code yet. Until it is written, no page should draw one.