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
npx shadcn@latest add @ritla/chipDependencies 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
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | Figma's Label. | |
size | "sm" | "lg" | "sm" | Figma's Size: 24 or 32px. |
badge | ReactNode | Figma's Show Badge: a count after the label. | |
leading / flag | IconComponent | ReactNode / string | Assist: Figma's Style = Icon or Flag. | |
…button props | ComponentProps<"button"> | onClick, disabled and the rest. |
FilterChip
| Prop | Type | Default | Description |
|---|---|---|---|
selected / defaultSelected | boolean | Figma's Selected. | |
onSelectedChange | (selected: boolean) => void | When it's toggled. | |
caret | boolean | false | Figma's Show Trailing: a caret while selected. |
InputChip
| Prop | Type | Default | Description |
|---|---|---|---|
leading / flag | IconComponent | ReactNode / string | Figma's Leading: an icon, an avatar or a flag. | |
onRemove | () => void | Adds the remove button. | |
disabled | boolean | Disabled. |
CheckboxChip
| Prop | Type | Default | Description |
|---|---|---|---|
checked / defaultChecked / onCheckedChange | … | Figma's Selected, as on Checkbox. | |
leading / flag | IconComponent | ReactNode / string | Figma'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.
| Key | Action |
|---|---|
| Tab | Between chips and remove buttons. |
| SpaceEnter | Activates 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 isrole="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
numeralsthroughformatNumber. - Arabic typography
label-12at sm andlabel-14at lg, Medium.