Chip
Small interactive elements: they suggest, act as shortcuts, filter, hold entered values or work as multi-select options.
Ritla scan of this preview: 41 of 41 checks3 breakpointsScanned
Preview
Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.
Installation
Add the component
npx ritla add chipAlso works with shadcn:
npx shadcn@latest add @ritla/chipDependencies it brings
@base-ui/react@phosphor-icons/reactOr copy by hand
Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.
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 | None | Figma's Label. |
size | "sm" | "lg" | "sm" | Figma's Size: 24 or 32px. |
badge | ReactNode | None | Figma's Show Badge: a count after the label. |
leading / flag | IconComponent | ReactNode / string | None | Assist: Figma's Style = Icon or Flag. |
…button props | ComponentProps<"button"> | None | onClick, disabled and the rest. |
FilterChip
| Prop | Type | Default | Description |
|---|---|---|---|
selected / defaultSelected | boolean | None | Figma's Selected. |
onSelectedChange | (selected: boolean) => void | None | 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 | None | Figma's Leading: an icon, an avatar or a flag. |
onRemove | () => void | None | Adds the remove button. |
disabled | boolean | None | Disabled. |
CheckboxChip
| Prop | Type | Default | Description |
|---|---|---|---|
checked / defaultChecked / onCheckedChange | … | None | Figma's Selected, as on Checkbox. |
leading / flag | IconComponent | ReactNode / string | None | Figma's Leading. |
name / value / disabled | … | None | For forms. |
Usage guidelines
A chip is a control people press. How it differs from a tag, which chip to choose, how chips run in Arabic, and the checks before handoff.
1. Tag or chip
Tags are labels: a status or a category people read, such as Paid or Overdue. Chips are controls: people press them. If pressing it should do something, it is a chip; if not, it is a tag and must never look pressable.
| Component | Use |
|---|---|
| Tag | A status or category that people read. Not interactive. |
| Suggestion chip | Quick picks people can tap: an amount, a reply. |
| Assist chip | A shortcut action related to the content, with an icon. |
| Filter chip | Turn a filter on or off; applies at once. |
| Input chip | A value people entered or picked, with a remove button. |
| Checkbox chip | Several options in a form, saved on submit. |
2. Choosing a chip
Suggestion and Assist chips are shortcuts. Filter chips change a list immediately. Input chips hold values people added and can remove. Checkbox chips pick several options in a form and wait for submit. Keep chips in one row that wraps, all the same size.
Do
- Apply filter chips at once, without an Apply button.
- Give input chips a remove button named after the value: Remove Layla Haddad.
- Wrap chips onto a second line rather than scrolling hidden ones.
- Keep one size of chip per row.
Don't
- Use chips for primary actions; use Buttons.
- Mix filter chips and checkbox chips in one row.
- Hide selected filters off screen.
3. Arabic and RTL
Use the RTL variants: leading icons, flags and checks move to the right, trailing icons and remove buttons to the left, and a row of chips starts on the right. Write status words natively and keep them as short as in English.
Before handoff
- Tags for statuses, chips for anything pressed.
- Chip behavior is noted: applies at once, removable, or saved on submit.
- Arabic screens use the RTL variants.
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.
- After a removal, focus moves to the next chip's remove button, or the previous one when no chip follows, so it isn't lost. After removing the last chip, return focus to your input yourself.
- The touch target is 48px tall, even for the small chip.
Do
- Filter chips announce whether they are on (
aria-pressed). - Name remove buttons with their value.
- A 48 px touch target, which code adds.
Don't
- Rely on color alone to show which filter is on; the check shows it too.
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.
Do
- Use the RTL variants for Arabic chips.
- Start rows of chips on the right.
- Write chip labels natively in Arabic.
Don't
- English chips with Arabic labels.
- Translate labels literally when a shorter native word exists.
Checks it passes
The Ritla checks this component satisfies by construction. Used as documented, it does not bring these defects onto your page.