Tag
Labels, categorizes or marks the state of an item with a colored pill and an optional icon.
Em análise
size
variant
<Tag size="md" variant="info">Em análise</Tag>Which one to use
Tag, Badge, Chip and Status badge look alike. They answer different questions.
| Component | What it is | Interactive | Example |
|---|---|---|---|
| Tag (this page) | A label in three sizes, with an optional icon. | No | “Aprovado” with a check icon. |
| Badge | The same as a Tag, always sm, with older names. |
No | “Novo” next to a menu item. |
| Chip | An applied filter or selected value you can remove. | Yes | “Revisor: Marina Costa” with ×. |
| Status badge | A processing status picked from a backend code. | No | “Processando” with an icon. |
Use Tag when you choose the text, the color and the icon. Use Status badge when the text comes from a backend status code.
When to use
- To label an item with a category, type or state: “Em análise”, “Aprovado”, “Prazo em 2 dias”.
- In tables, cards and detail headers, usually at
sm. - When the state needs an icon next to the text.
When not to use
- A filter or value the user can remove. Use Chip.
- A processing status from the backend. Use Status badge.
- A number of unread items. Use Notification badge.
- A message about the page or a task. Use Alert.
- An action. Use Button. A Tag does not respond to clicks.
Variants
When no variant is passed, the tag is default.
Novidade
Padrão
Arquivado
Rejeitado
Em análise
Contorno
Destaque
Aprovado
Pendente
| Variant | Use for |
|---|---|
default |
Neutral category or type. |
primary |
A brand highlight. |
accent |
Something new or featured. |
info |
Informational state, such as “Em análise”. |
success |
Completed or approved. |
warning |
Needs attention, such as “Pendente”. |
error |
Failed or rejected. |
disabled |
Inactive or archived. |
outline |
A bordered neutral tag. |
Sizes
sm · 24px
md · 36px
lg · 40px
| Size | Height | Use for |
|---|---|---|
sm |
24px | Tables, lists and dense cards. |
md, default |
36px | Default. Headers and detail pages. |
lg |
40px | Prominent labels. |
States
data-selected adds a ring in the text color. It is a visual mark only: the tag does not toggle by itself.
Em análise
Em análise
Icons
Pass a Lucide component to icon. Pair the color with an icon and a label so the state is not signaled by color alone.
Aprovado
Pendente
Rejeitado
Em análise
Destaque
With asChild, the icon prop is ignored. Put the icon inside the child.
Prazo em 2 dias
Content
- One to three words: “Em análise”, “Prazo em 2 dias”.
- Sentence case, no period.
- Describe the state, not the action.
- Do not truncate. The tag never wraps (
whitespace-nowrap), so keep the text short.
Do and don’t
Aprovado
Contestação
Accessibility
- It renders a static
divwith no role. It is not focusable and is read as plain text. - Status colors are never the only signal. Always write the state as text, and add an icon for
success,warning,errorandinfo: check circle, clock or triangle alert, octagon alert, info. - The
iconprop renders the component withoutaria-hidden. Lucide marks its icons hidden by default, but a custom icon component should setaria-hidden="true". - Hit target:
smis 24px tall, which meets the minimum, but a Tag is not a control. Do not attach click handlers to it. Use Button or Chip. - Check the contrast of each variant in Light, Dark and Darker.
Code
import { Tag } from "@repo/ui/tag";
<Tag icon={CircleCheck} size="sm" variant="success">
Aprovado
</Tag>
// Styles on your own element
<Tag asChild size="sm" variant="warning">
<span>Prazo em 2 dias</span>
</Tag>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Renders the child element with tag styles, using Radix Slot. The `icon` prop is ignored in this mode |
icon | React.ElementType | — | Icon component shown before the label |
size | "default" | "lg" | "md" | "sm" | md | Height, padding and type size |
variant | "accent" | "default" | "disabled" | "error" | "info" | "outline" | "primary" | "success" | "warning" | default | Semantic color of the tag |
Known issues
| Issue | Effect |
|---|---|
data-selected styles the tag as selected, but it is a non-interactive div. |
Looks like a toggle. It has no role, no aria-pressed and no keyboard support. |
icon is ignored when asChild is true. |
The prop silently does nothing. Put the icon inside the child. |
The icon node has no aria-hidden. |
Decorative icons rely on the icon library to hide them from screen readers. |
default and md are aliases with the same classes. |
Two names for one size. The size order is kept by hand with a lint disable. |
TagProps is an interface and the component uses forwardRef. |
Code only: the repository prefers type, and React 19 accepts ref as a prop. |