Chip
Shows an applied filter or a selected value as a compact pill, optionally with a button to remove it.
size
variant
<Chip dismissible dismissLabel="Remover filtro de revisor" size="md" variant="default">Revisor: Marina Costa</Chip>Which one to use
Chip, Tag, Badge and Status badge look alike. They answer different questions.
| Component | What it is | Interactive | Example |
|---|---|---|---|
| Chip (this page) | An applied filter or selected value, often removable. | Yes | “Revisor: Marina Costa” with ×. |
| Tag | A label in three sizes, with an optional icon. | No | “Aprovado” with a check icon. |
| Badge | The same as a Tag, always sm. |
No | “Novo” next to a menu item. |
| Status badge | A processing status picked from a backend code. | No | “Processando” with an icon. |
Ask: does the user act on it? If they can remove it or open it, use Chip. If it only describes the item, use Tag or Badge.
When to use
- To list the filters applied to a table or a list, each one removable.
- To show the values chosen in a multi-select.
- As the trigger of an editable filter (
variant="filter"withasChild).
When not to use
- A label that only describes an item. Use Tag or Badge.
- A processing status. Use Status badge.
- Switching between views or sections. Use Tabs.
- A boolean setting. Use Switch or Checkbox.
Variants
variant sets how the chip looks when it is selected.
| Variant | Use for |
|---|---|
default |
Applied values. Selected uses the light brand fill. |
filter |
An editable filter in a compact rectangular shape. |
info |
Selected state with information color. |
warning |
Selected state with warning color. |
inverted |
Selected state with high contrast. |
Sizes
| Size | Height | Use for |
|---|---|---|
sm |
28px | Dense toolbars. |
compact |
32px | Filter bars. |
md |
36px | Default. Forms and lists. |
States
Selected comes from selected, which sets data-selected. Selected chips appear in the second row of Variants. Hover and pressed fills are built in.
Examples
Add a leading icon with icon.
Set dismissible and onDismiss for a removable chip. Name what the button removes with dismissLabel.
The filter variant is meant to wrap a trigger with asChild.
Content
- Show the field and the value when the field is not obvious: “Revisor: Marina Costa”, “Status: Pendente”.
- Sentence case, no period.
- Write
dismissLabelas the action and the object: “Remover filtro de revisor”. Apps pass it translated.
Do and don’t
Accessibility
- The chip root is a
divand is not focusable. Only the dismissbutton(type="button") receives focus, and Enter and Space activate it. - The dismiss button has
aria-labelfromdismissLabel(default “Remover”). Use a specific label so a list of chips is not a list of identical “Remover” buttons. - The × button is 24px, which meets the minimum hit target. Its focus uses a ring (
focus-visible:ring-1). - Selection is exposed only through
data-selected, not through ARIA. Do not rely on it for screen readers: pair the chip with text such as “Status: Pendente”. - Color is never the only signal for selection in
default: the fill and text change, and the label stays visible. Forinfoandwarning, keep the label explicit. - When you use
asChild, you own the semantics. Wrap a realbuttonora. - The icon is
aria-hidden.
Code
import { Chip } from "@repo/ui/chip";
<Chip
dismissLabel="Remover filtro de revisor"
dismissible
icon={User}
onDismiss={handleRemove}
selected
>
Revisor: Marina Costa
</Chip>
// Filter trigger
<Chip asChild size="compact" variant="filter">
<button type="button">Status</button>
</Chip>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Renders the child element with chip styles, using Radix Slot. `icon` and `dismissible` are ignored in this mode |
dismissible | boolean | false | Shows an × button that calls `onDismiss` |
dismissLabel | string | Remover | Accessible name of the dismiss button. Pass translated copy from the app |
icon | React.ElementType | — | Icon component shown before the label |
onDismiss | function | — | Called when the × button is clicked |
selected | boolean | — | Marks the chip as selected through `data-selected` |
size | "compact" | "md" | "sm" | md | Height, padding and type size |
variant | "default" | "filter" | "info" | "inverted" | "warning" | default | Appearance of the chip when idle and when selected |
Known issues
| Issue | Effect |
|---|---|
The root div has hover and active color changes but no role, no tabindex. |
A chip without asChild looks clickable on hover but cannot be focused or activated from the keyboard. |
The root uses focus:ring-2, but a div cannot take focus. |
The focus ring never shows for the default chip. It only works when asChild wraps a focusable element. |
selected is only a data-selected attribute. |
No aria-pressed or aria-selected: screen readers do not hear the selected state. |
The dismiss button uses opacity-80 and hover:opacity-100. |
Transparency for hover feedback, against the no-translucency rule. |
dismissLabel defaults to the Portuguese word “Remover”. |
A hardcoded default inside an i18n-free package. Apps must pass the translated label. |
icon and dismissible are ignored with asChild. |
The props do nothing in that mode and give no warning. |