Build · New

Chip

Small interactive elements: they suggest, act as shortcuts, filter, hold entered values or work as multi-select options.

Preview

Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.

Installation

SoonInstalling from the registry opens at launch. Until then the command below is what it will be.
npx shadcn@latest add @ritla/chip

Dependencies it brings: @base-ui/react, @phosphor-icons/react

Usage

import { FilterChip, SuggestionChip } from "@/components/ui/chip";
<SuggestionChip size="lg" onClick={() => setAmount(100)}>100 SAR</SuggestionChip>
<FilterChip defaultSelected>Income</FilterChip>

Examples

Assist chip

A shortcut with an icon or a flag, and an optional count with badge.

Filter chip

A toggle button: selected shows a check, and caret adds a caret for a chip that opens its options.

Input chip

A value the person picked; onRemove adds a remove button with a clear name (Remove Layla Haddad).

Checkbox chip

A multi-select option with a real checkbox; the whole chip is its label.

API reference

SuggestionChip / AssistChip

PropTypeDefaultDescription
childrenReactNodeFigma's Label.
size"sm" | "lg""sm"Figma's Size: 24 or 32px.
badgeReactNodeFigma's Show Badge: a count after the label.
leading / flagIconComponent | ReactNode / stringAssist: Figma's Style = Icon or Flag.
…button propsComponentProps<"button">onClick, disabled and the rest.

FilterChip

PropTypeDefaultDescription
selected / defaultSelectedbooleanFigma's Selected.
onSelectedChange(selected: boolean) => voidWhen it's toggled.
caretbooleanfalseFigma's Show Trailing: a caret while selected.

InputChip

PropTypeDefaultDescription
leading / flagIconComponent | ReactNode / stringFigma's Leading: an icon, an avatar or a flag.
onRemove() => voidAdds the remove button.
disabledbooleanDisabled.

CheckboxChip

PropTypeDefaultDescription
checked / defaultChecked / onCheckedChange…Figma's Selected, as on Checkbox.
leading / flagIconComponent | ReactNode / stringFigma's Leading.
name / value / disabled…For forms.

Accessibility

Keyboard

Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.

KeyAction
TabBetween chips and remove buttons.
SpaceEnterActivates or toggles the chip (the checkbox with Space).

ARIA

  • Suggestion and assist chips are buttons; the filter chip is a button with aria-pressed; the checkbox chip is role="checkbox" named by its text.
  • The remove button is named "Remove" plus the value, in the page language.
  • The touch target is 48px tall, even for the small chip.

Arabic and RTL notes

Mirrors

  • Icons, flags and the checkbox sit at the chip's start (the right), the remove button and the caret at its end.

Does not mirror

  • The check, the X and flags don't mirror.
Numerals
Amounts and counts in chips follow numerals through formatNumber.
Arabic typography
label-12 at sm and label-14 at lg, Medium.

All components ›