Skip to content

Chip

Get Ritla UI

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

Open in Figma

Preview

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

PreviewCode
EnglishMirroredArabic
LTR →

Installation

  1. Add the component

    npx ritla add chip

    Also works with shadcn: npx shadcn@latest add @ritla/chip

  2. Dependencies it brings

    @base-ui/react@phosphor-icons/react

  3. Or 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

chip.tsx
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.

EnglishMirroredArabic
LTR →

Filter chip

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

EnglishMirroredArabic
LTR →

Input chip

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

EnglishMirroredArabic
LTR →

Checkbox chip

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

EnglishMirroredArabic
LTR →

API reference

SuggestionChip / AssistChip

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

FilterChip

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

InputChip

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

CheckboxChip

PropTypeDefaultDescription
checked / defaultChecked / onCheckedChange…NoneFigma's Selected, as on Checkbox.
leading / flagIconComponent | ReactNode / stringNoneFigma's Leading.
name / value / disabled…NoneFor 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.

ComponentUse
TagA status or category that people read. Not interactive.
Suggestion chipQuick picks people can tap: an amount, a reply.
Assist chipA shortcut action related to the content, with an icon.
Filter chipTurn a filter on or off; applies at once.
Input chipA value people entered or picked, with a remove button.
Checkbox chipSeveral 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.

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.
  • 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 numerals through formatNumber.
Arabic typography
label-12 at sm and label-14 at 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.

  • R050Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
  • R051letter-spacing applied to Arabic text (breaks the connected script)
  • R043Fixed-pixel-width container whose Arabic text exceeds the space