---
title: "Tag"
description: "Nombra una categoría o un estado con un rótulo estático y breve, de forma discreta, con contorno o con relleno, en los colores de un estado cuando lo tiene. Es texto, nunca un control."
url: "https://tanrei.chnotchy.com/es/components/tag/"
last_updated: 2026-10-23T21:17:12.000Z
---

# Tag

> Nombra una categoría o un estado con un rótulo estático y breve, de forma discreta, con contorno o con relleno, en los colores de un estado cuando lo tiene. Es texto, nunca un control.

## Descripción general

Un tag es una palabra o una frase corta que dice qué es una cosa o en qué estado está: la categoría de un artículo, el resultado de una compilación, la fase de una versión, el valor predeterminado entre varios. Ocupa su lugar en el diseño, en línea con el texto que tiene al lado, y nunca responde a un puntero, a una tecla ni al foco.

En la web es `<tanrei-tag>`. Las demás plataformas todavía no lo han implementado.

### Uso

**Web**

```html
<tanrei-tag label="Beta"></tanrei-tag>
<tanrei-tag variant="outlined" label="Diseño"><span slot="icon">sell</span></tanrei-tag>

<!-- La etiqueta dice el estado. -->
<tanrei-tag status="error" label="Fallido"></tanrei-tag>

<!-- La etiqueta no lo dice: status-label se lee antes de ella («Error, 3 compilaciones») y no se dibuja. -->
<tanrei-tag status="error" status-label="Error" label="3 compilaciones"></tanrei-tag>

<script type="module">
  import '@tanrei/web/components/tag';
</script>
```

**React**

```tsx
import { Tag } from '@tanrei/react';

<Tag label="Beta" />
<Tag variant="outlined" label="Diseño"><span slot="icon">sell</span></Tag>
<Tag status="error" statusLabel="Error" label={`${failed} compilaciones`} />
```

## Especificaciones

- Category: Communication
- Level: base
- Listing: default
- Page: https://tanrei.chnotchy.com/components/tag/
- Spec: https://github.com/chnotchy/tanrei/blob/main/specs/tag.spec.json

### Availability

| Design system | Has it | Notes |
| --- | --- | --- |
| Tanrei (`tanrei`) | Yes | — |
| Cupertino (Apple HIG-inspired) (`cupertino`) | Yes | — |
| M3 Expressive-like (Material 3 Expressive-inspired) (`m3-expressive-like`) | Yes | — |
| M3-like (Material 3-inspired) (`m3-like`) | Yes | — |

### Platforms

- Web: the element `<tanrei-tag>`, registered by importing `@tanrei/web` (or only its own module, `@tanrei/web/components/tag`).
- React: `Tag` from `@tanrei/react`.

| Platform | Name | Status |
| --- | --- | --- |
| Web | `tanrei-tag` | lagging |
| SwiftUI | `TanreiTag` | planned |
| Jetpack Compose | `TanreiTag` | planned |
| Flutter | `TanreiTag` | planned |
| React Native | `Tag` | planned |

Names a platform gives in its own idiom:

| Spec | Web | SwiftUI | Jetpack Compose | Flutter | React Native |
| --- | --- | --- | --- | --- | --- |
| `label` (prop) | `label` | `title` | `label` | `label` | `label` |
| `statusLabel` (prop) | `statusLabel` | `statusLabel` | `statusDescription` | `statusSemanticLabel` | `statusAccessibilityLabel` |
| `dot` (prop) | `dot` | `showsDot` | `showDot` | `showDot` | `dot` |
| `disabled` (prop) | `disabled` | `isDisabled` | `enabled` | `enabled` | `disabled` |

Statuses: `planned` — In the inventory. Nothing shippable exists yet. `lagging` — An implementation of an earlier spec exists; it has not caught up with the current one. `alpha` — Implemented with tests. The API may still change. `beta` — Feature complete and at parity. Only fixes are expected. `stable` — Covered by semantic versioning. `deprecated` — Still shipped; scheduled for removal.

### Anatomy

- `container`: The shape that holds the label: at least the height of its size, a pill in the default system, filled in the tonal and filled looks and edged in the outlined look. It carries no state: nothing about it answers a pointer, a press or focus.
- `label`: The word or short phrase the tag shows, on one line.
- `icon` (optional): A leading glyph of the system's icon set that the product names (a category's mark, a status's mark). Decorative: the label says what the tag means.
- `dot` (optional): A small filled circle in the leading position, in the look's mark color: the lightest way to show a status beside its word. Drawn where the product asks for it and no glyph is given, and always on an outlined tag that has a status.
- `outline` (optional): The outlined look's edge: one hairline inside the container, the same in every status.

### Props

| Prop | Type | Default | Web attribute | Description |
| --- | --- | --- | --- | --- |
| `label` | `string` | `""` | `label` | The tag's text: a word or a short phrase ("Beta", "Out of stock"). It is what the tag draws and what assistive technology reads. |
| `variant` | `enum`: `tonal`, `outlined`, `filled` | `"tonal"` | `variant` | How much the tag weighs. tonal: a quiet fill, the default. outlined: no fill and one hairline, for many tags close together. filled: a full fill, for the chosen one among its neighbours (the default among values, the required among fields) and for the one status that must not be missed. |
| `status` | `enum`: `default`, `info`, `warning`, `error`, `success` | `"default"` | `status` | What the tag reports, in the names the snackbar uses. default: a category or a neutral state, in the look's own colors. info, warning, error and success draw the look in that status's color roles. It changes colors only; the words are the label's and statusLabel's. |
| `statusLabel` | `string` | `""` | `status-label` | The status in words, in the product's language ("Error"), read by assistive technology before the label and not drawn. For a tag whose label does not itself say the status (an error tag that reads "3 builds"); a label that says it ("Failed") needs none. Ignored while status is default. |
| `size` | `enum`: `small`, `medium` | `"medium"` | `size` | Small (20 high, 12 text) follows a field's label, a table cell or a line of body text without making the line taller; medium (24 high, 14 text) stands beside a heading or by itself. |
| `dot` | `boolean` | `false` | `dot` | Draws the dot before the label, in the look's mark color. A glyph in the icon slot takes its place. An outlined tag with a status draws the dot whatever this says, because nothing else in that look shows the status. |
| `disabled` | `boolean` | `false` | `disabled` | Draws the tag as part of something disabled — the label of a disabled field, a disabled row of a list, a disabled item of a menu — in its look's disabled colors, so that it fades with what it stands in. It changes nothing else: a tag takes no input and no focus, and what assistive technology hears of the disabled state it hears from the element the tag stands in. The component that holds the tag sets it (a Field does, for its requirement tag); a product sets it on a tag it places in a disabled element of its own. |

### Slots

| Slot | Description |
| --- | --- |
| `icon` | The leading glyph: a glyph of the system's icon set, drawn through the platform's icon helper at the tag's glyph size. |

### States

`enabled`, `disabled`

### Accessibility

- Role: `none`
- Labeling: The tag has no role and no name of its own: it is text, read where it sits. What is read is label, preceded by statusLabel where the tag has a status and the product gave one ("Error, 3 builds"). The glyph and the dot are decorative and hidden. Inside a link, a button, a list item or a table cell the tag's text is part of that element's content.
- Minimum target size: yes

- Not interactive: the tag takes no input and no focus (TAG-9), so there is no target to size. minimumTarget holds trivially. A label that must be pressed, selected or removed is a chip; one that leads somewhere is a link.
- A status never rests on color alone (WCAG 1.4.1): the label says it ("Failed", "Stable"), or statusLabel adds it in words. The component cannot tell whether a label says its status, so this is the product's to check; the docs page says so with examples.
- Several tags in a row are the product's to group: where they are a set (an article's categories), the product lays them out in its platform's list semantics (ul and li on the web) and names the list. The tag does not group itself and has no list role.
- A tag does not announce a change of its text or status (TAG-12). Where a change must be announced (a build that finishes while the person watches), the product puts the tag in a live region or reports the change with a snackbar.
- A label cut by TAG-5 is still read in full by assistive technology, but a person who sees the ellipsis has no way to read the rest from the tag itself: it takes no hover and no focus. Give a tag room for its label, or let the element that holds it (a table cell, a list item) show the full text.
- Contrast in the default system: every label is a role drawn on its paired role (on-secondary-container on secondary-container, on-error-container on error-container, on-primary on primary, on-error on error, on-surface on a surface), each held to 4.5:1 by the token invariants. The status color used for a glyph or a dot keeps 3:1 against its status container and against every surface (it is held to 4.5:1 as text on surfaces). The outlined look's edge is decorative.
- Forced colors (TAG-14): a filled or tonal tag loses its fill, so every look gains an edge in the text color. Statuses then look alike, which is why the status must be in words.

### Behaviour

Requirements in EARS form, each with its stable id.

- **TAG-1** THE tag SHALL draw a container at least the height of its size (comp.tag.container.height.medium for medium, and so on) with corners comp.tag.container.shape, never larger than half the container's height (a pill where the value is sys.shape.corner.full, at any height the tag grows to) and eased by sys.shape.corner-smoothing, and lay out in one row its glyph or its dot, where it has one, and its label, comp.tag.container.gap apart; the start SHALL be padded by comp.tag.container.padding-inline-with-icon.medium where it holds the glyph or the dot and by comp.tag.container.padding-inline.medium where the label meets it, the end by comp.tag.container.padding-inline.medium, and the row's tallest item (the label's line or the glyph's box) SHALL be padded at the top and bottom by at least comp.tag.container.padding-block.medium (and so on for each size). THE tag SHALL be as wide as its content and its paddings, never wider than its layout gives it, and SHALL draw no elevation.
- **TAG-2** WHILE status is default THE tag SHALL fill its container with the container color of its variant and draw its label, and its glyph or dot, in that variant's label and icon colors: comp.tag.tonal.container.color, comp.tag.tonal.label.color and comp.tag.tonal.icon.color for tonal, and outlined's and filled's tokens of the same names (comp.tag.outlined.container.color, comp.tag.filled.container.color, and so on).
- **TAG-3** WHILE status is info, warning, error or success THE tag SHALL draw its container, its label and its glyph or dot from the parts of its variant prefixed with the status: for a tonal info tag comp.tag.tonal.info.container.color, comp.tag.tonal.info.label.color and comp.tag.tonal.info.icon.color; for outlined and filled, and for warning, error and success, their own tokens of the same names (comp.tag.outlined.error.icon.color, comp.tag.filled.success.container.color, and so on). A status SHALL change these colors only: the tag's size, shape, layout and edge stay those of its variant and size, and the tag SHALL NOT draw a glyph the product did not give.
- **TAG-4** WHILE variant is outlined THE tag SHALL draw an edge comp.tag.outline.width wide in comp.tag.outline.color inside its container's size, following its corners, in every status, without changing the tag's size or the place of its content; WHILE variant is tonal or filled it SHALL draw no edge. A status SHALL NOT color the edge: it is the system's one hairline.
- **TAG-5** THE tag SHALL set its label on one line in the text style of its size (comp.tag.label.typescale.medium for medium, and so on) and the label color of its look (TAG-2, TAG-3), SHALL NOT wrap it, and SHALL cut it with an ellipsis only when the layout gives the tag less width than the label needs, keeping its paddings and its glyph or dot whole; the full label SHALL remain what assistive technology reads.
- **TAG-6** WHERE the icon slot holds a glyph THE tag SHALL draw it before the label in a box of comp.tag.icon.size, centred on the label's line, in the icon color of its look (TAG-2, TAG-3), with sys.icon.family.unselected and sys.icon.fill.unselected, sys.icon.weight and an optical size clamped between sys.icon.optical-size.min and sys.icon.optical-size.max, SHALL keep it from assistive technology, and SHALL draw no mark of its own in its place.
- **TAG-7** WHILE dot is true and the icon slot is empty THE tag SHALL draw before the label a filled circle of diameter comp.tag.dot.size in the icon color of its look (TAG-2, TAG-3), centred on the label's line, a circle whatever corners the container has, and SHALL keep it from assistive technology; WHERE the icon slot holds a glyph THE tag SHALL draw the glyph and no dot.
- **TAG-8** WHILE variant is outlined and status is info, warning, error or success and the icon slot is empty THE tag SHALL draw the dot of TAG-7 whether dot is true or false, because an outlined tag keeps the surface's label color and the one hairline in every status, so its mark is the only place the status shows.
- **TAG-9** THE tag SHALL NOT take pointer, touch or keyboard input, SHALL NOT take focus or be a stop in the focus order, and SHALL NOT change anything it draws under a pointer, a press or focus: it has no hovered, focused, pressed or selected state and no disabled state of its own — disabled draws it as part of something disabled and changes nothing it does (TAG-21) — draws no state layer, no ripple and no focus indicator, and emits no event.
- **TAG-10** WHERE the tag is placed inside an element that takes input (a link, a button, a list item, a table row, a card that is pressed as a whole) THE tag SHALL let input over it reach that element, SHALL stay as it is drawn while that element is hovered, focused or pressed (the state is drawn by that element, on its own container), and SHALL add its text (TAG-11) to that element's content in reading order; it SHALL NOT become a second target inside it.
- **TAG-11** THE tag SHALL expose its label as plain text, read where the tag sits, with no role, name or state of its own; WHILE status is not default and statusLabel is not empty THE tag SHALL expose statusLabel before the label as part of that text, set apart so that the two are read as two phrases ("Error, 3 builds"), and SHALL NOT draw it; WHILE status is default THE tag SHALL ignore statusLabel. THE tag SHALL NOT expose its variant, its size or its status in any other way: a status is given in words or not at all.
- **TAG-12** WHEN label, status or statusLabel changes THE tag SHALL draw and expose the new value at once, without a motion, and SHALL NOT announce the change by itself.
- **TAG-13** THE tag SHALL lay itself out inline with the text or the row it is placed in, as one unbreakable box, with the baseline of its label on the baseline of the text beside it; WHILE the text size is enlarged THE tag SHALL grow its container with its label, keeping the height of its size as a minimum, its paddings, and its glyph box and its dot at comp.tag.icon.size and comp.tag.dot.size.
- **TAG-14** WHERE the platform draws with a person's own forced colors (the web's forced-colors mode, and a platform's equivalent where it has one) THE tag SHALL draw an edge comp.tag.outline.width wide in the platform's text color inside its container in every variant, and its label, glyph and dot in that text color, so that a look whose fill the mode removes is still a bounded label; the status SHALL then rest on the label's words and statusLabel alone.
- **TAG-15** WHERE the layout direction is right-to-left THE tag SHALL mirror the order of its content and apply its paddings by logical start and end, so that the glyph or the dot sits at the right of the label.
- **TAG-16** THE tag SHALL take its layout direction from where it is used — the direction of the nearest ancestor that sets one, and the platform's own where none does — and SHALL have no direction setting of its own; WHEN that direction changes while the tag is shown THE tag SHALL draw itself for the new direction at once, without a motion of its own, keeping what it shows.
- **TAG-17** WHERE the layout direction is right-to-left THE tag SHALL draw the glyph of its icon slot mirrored left to right exactly when the system's icon set marks that glyph's name as mirrored or the product forces mirroring for that use, and unmirrored when the product forbids it: the icon helper mirrors the glyph inside its own box, about the box's vertical centre line, changing neither its place, size, color and fill nor the order TAG-15 gives. THE tag SHALL NOT mirror a glyph itself, and SHALL NOT mirror content the product gives as an image or a view of its own rather than by a glyph's name. The dot is never mirrored.
- **TAG-18** THE tag SHALL lay out its label as text of its own direction, isolated from the text around it: it takes the base direction of its first strong character, or the layout direction where it has none, so that a left-to-right word, a number with its sign or unit, a version and a date keep their own order in a right-to-left layout and reorder nothing beside them; THE tag SHALL still place the label by the layout direction, not by the text's own, and SHALL cut a label that does not fit (TAG-5) at the end of its own direction, so that a left-to-right label in a right-to-left layout loses its right end and never its beginning.
- **TAG-19** WHEN variant or size names a value that the active design system does not have, or status names a value this spec does not have, THE tag SHALL render with the default value (the default variant's or size's tokens, status default), and in debug builds report the unknown value.
- **TAG-20** IF label is empty THE tag SHALL draw nothing, take no space and expose nothing, and in debug builds report that a tag has no text: a glyph or a dot alone is not a tag. IF statusLabel is not empty while status is default THE tag SHALL ignore it and in debug builds report it.
- **TAG-21** WHILE disabled is true — the tag stands inside something disabled, and the component that holds it, or the product, says so — THE tag SHALL draw its fill, its label, its glyph and its dot from its look's disabled tokens (comp.tag.\<variant>.disabled.container.color, comp.tag.\<variant>.disabled.label.color and comp.tag.\<variant>.disabled.icon.color, and their parts of each status), whatever its status, so that it fades with what it stands in and does not read as the one live part of a disabled whole; an outlined tag SHALL keep its edge and draw no fill. disabled SHALL change nothing else: the tag SHALL keep its size, its label and its place, take no input and no focus (TAG-9), and keep its text readable by assistive technology, which hears the disabled state from the element the tag stands in, never from the tag. WHERE the platform draws with a person's own forced colors THE tag SHALL draw its edge, its label, its glyph and its dot in the platform's color for disabled text (GrayText on the web) in place of its text color (TAG-14).

### Tokens

As written in the token documents (DTCG): an alias in braces names the token it takes its value from, which each design system resolves. On the web each token is a CSS custom property: `--tanrei` and the name after `tanrei`, joined by hyphens (`tanrei.comp.tag.…` → `--tanrei-comp-tag-…`).

#### `tanrei.comp.tag`

| Token | Type | Value |
| --- | --- | --- |
| `comp.tag.container.height.small` | `dimension` | `20px` |
| `comp.tag.container.height.medium` | `dimension` | `24px` |
| `comp.tag.container.padding-inline.small` | `dimension` | `{tanrei.sys.space.space75}` |
| `comp.tag.container.padding-inline.medium` | `dimension` | `{tanrei.sys.space.space100}` |
| `comp.tag.container.padding-inline-with-icon.small` | `dimension` | `{tanrei.sys.space.space50}` |
| `comp.tag.container.padding-inline-with-icon.medium` | `dimension` | `{tanrei.sys.space.space75}` |
| `comp.tag.container.padding-block.small` | `dimension` | `2px` |
| `comp.tag.container.padding-block.medium` | `dimension` | `2px` |
| `comp.tag.container.gap` | `dimension` | `{tanrei.sys.space.space50}` |
| `comp.tag.container.shape` | `dimension` | `{tanrei.sys.shape.corner.full}` |
| `comp.tag.outline.color` | `color` | `{tanrei.sys.color.outline-variant}` |
| `comp.tag.outline.width` | `dimension` | `{tanrei.sys.border.hairline}` |
| `comp.tag.label.typescale.small` | `typography` | `{tanrei.sys.typescale.label-small}` |
| `comp.tag.label.typescale.medium` | `typography` | `{tanrei.sys.typescale.label}` |
| `comp.tag.icon.size` | `dimension` | `{tanrei.sys.icon.extra-small}` |
| `comp.tag.dot.size` | `dimension` | `{tanrei.sys.space.space100}` |
| `comp.tag.tonal.container.color` | `color` | `{tanrei.sys.color.secondary-container}` |
| `comp.tag.tonal.label.color` | `color` | `{tanrei.sys.color.on-secondary-container}` |
| `comp.tag.tonal.icon.color` | `color` | `{tanrei.comp.tag.tonal.label.color}` |
| `comp.tag.tonal.info.container.color` | `color` | `{tanrei.sys.color.info-container}` |
| `comp.tag.tonal.info.label.color` | `color` | `{tanrei.sys.color.on-info-container}` |
| `comp.tag.tonal.info.icon.color` | `color` | `{tanrei.sys.color.info}` |
| `comp.tag.tonal.warning.container.color` | `color` | `{tanrei.sys.color.warning-container}` |
| `comp.tag.tonal.warning.label.color` | `color` | `{tanrei.sys.color.on-warning-container}` |
| `comp.tag.tonal.warning.icon.color` | `color` | `{tanrei.sys.color.warning}` |
| `comp.tag.tonal.error.container.color` | `color` | `{tanrei.sys.color.error-container}` |
| `comp.tag.tonal.error.label.color` | `color` | `{tanrei.sys.color.on-error-container}` |
| `comp.tag.tonal.error.icon.color` | `color` | `{tanrei.sys.color.error}` |
| `comp.tag.tonal.success.container.color` | `color` | `{tanrei.sys.color.success-container}` |
| `comp.tag.tonal.success.label.color` | `color` | `{tanrei.sys.color.on-success-container}` |
| `comp.tag.tonal.success.icon.color` | `color` | `{tanrei.sys.color.success}` |
| `comp.tag.outlined.container.color` | `color` | `{"colorSpace":"srgb","components":[0,0,0],"alpha":0,"hex":"#000000"}` |
| `comp.tag.outlined.label.color` | `color` | `{tanrei.sys.color.on-surface}` |
| `comp.tag.outlined.icon.color` | `color` | `{tanrei.sys.color.on-surface-variant}` |
| `comp.tag.outlined.info.container.color` | `color` | `{tanrei.comp.tag.outlined.container.color}` |
| `comp.tag.outlined.info.label.color` | `color` | `{tanrei.comp.tag.outlined.label.color}` |
| `comp.tag.outlined.info.icon.color` | `color` | `{tanrei.sys.color.info}` |
| `comp.tag.outlined.warning.container.color` | `color` | `{tanrei.comp.tag.outlined.container.color}` |
| `comp.tag.outlined.warning.label.color` | `color` | `{tanrei.comp.tag.outlined.label.color}` |
| `comp.tag.outlined.warning.icon.color` | `color` | `{tanrei.sys.color.warning}` |
| `comp.tag.outlined.error.container.color` | `color` | `{tanrei.comp.tag.outlined.container.color}` |
| `comp.tag.outlined.error.label.color` | `color` | `{tanrei.comp.tag.outlined.label.color}` |
| `comp.tag.outlined.error.icon.color` | `color` | `{tanrei.sys.color.error}` |
| `comp.tag.outlined.success.container.color` | `color` | `{tanrei.comp.tag.outlined.container.color}` |
| `comp.tag.outlined.success.label.color` | `color` | `{tanrei.comp.tag.outlined.label.color}` |
| `comp.tag.outlined.success.icon.color` | `color` | `{tanrei.sys.color.success}` |
| `comp.tag.filled.container.color` | `color` | `{tanrei.sys.color.primary}` |
| `comp.tag.filled.label.color` | `color` | `{tanrei.sys.color.on-primary}` |
| `comp.tag.filled.icon.color` | `color` | `{tanrei.comp.tag.filled.label.color}` |
| `comp.tag.filled.info.container.color` | `color` | `{tanrei.sys.color.info}` |
| `comp.tag.filled.info.label.color` | `color` | `{tanrei.sys.color.on-info}` |
| `comp.tag.filled.info.icon.color` | `color` | `{tanrei.comp.tag.filled.info.label.color}` |
| `comp.tag.filled.warning.container.color` | `color` | `{tanrei.sys.color.warning}` |
| `comp.tag.filled.warning.label.color` | `color` | `{tanrei.sys.color.on-warning}` |
| `comp.tag.filled.warning.icon.color` | `color` | `{tanrei.comp.tag.filled.warning.label.color}` |
| `comp.tag.filled.error.container.color` | `color` | `{tanrei.sys.color.error}` |
| `comp.tag.filled.error.label.color` | `color` | `{tanrei.sys.color.on-error}` |
| `comp.tag.filled.error.icon.color` | `color` | `{tanrei.comp.tag.filled.error.label.color}` |
| `comp.tag.filled.success.container.color` | `color` | `{tanrei.sys.color.success}` |
| `comp.tag.filled.success.label.color` | `color` | `{tanrei.sys.color.on-success}` |
| `comp.tag.filled.success.icon.color` | `color` | `{tanrei.comp.tag.filled.success.label.color}` |

Per-state tokens, valued by the design system's pattern rules (not written by hand):

- `comp.tag.<variant>.<state>.<property>` for the variants `tonal`, `outlined`, `filled`, the states `disabled` and the properties `container.color`, `label.color`, `icon.color`, `info.container.color`, `info.label.color`, `info.icon.color`, `warning.container.color`, `warning.label.color`, `warning.icon.color`, `error.container.color`, `error.label.color`, `error.icon.color`, `success.container.color`, `success.label.color`, `success.icon.color`.

## Pautas

### Insignia, chip o tag

Los tres se distinguen de una vez por todas por lo que hacen:

| Tipo | Qué es | Dónde se sitúa | Recibe entrada |
| --- | --- | --- | --- |
| [Insignia](https://tanrei.chnotchy.com/es/components/badge/) | Un punto o un recuento unido a otro elemento. | En la esquina de su ancla, fuera del diseño. | No. La entrada llega al ancla. |
| [Chip](https://tanrei.chnotchy.com/es/components/chip/) | Un control. | En el diseño. | Sí: se pulsa, se conmuta o se quita, y tiene foco y estados. |
| Tag | Un rótulo estático. | En el diseño, en línea. | Nunca. |

1. Si se pulsa, se selecciona o se quita, es un chip. Si lleva a algún sitio, es un enlace.
2. Si es un número o un punto encima de otra cosa, es una insignia.
3. Si es una palabra que solo dice qué es una cosa o en qué estado está, es un tag.

Un tag nunca se convierte en un control por recibir un controlador de eventos. Dentro de un enlace, un botón, un elemento de lista o una fila que se pulsa entera, sigue siendo texto de ese elemento: la entrada que recibe llega al elemento, y es el elemento el que dibuja sus propios estados al pasar el cursor, de foco y de pulsación.

### Cómo elegir un aspecto

| `variant` | Qué dibuja | Úsalo para |
| --- | --- | --- |
| `tonal` (predeterminado) | Un relleno discreto. | La mayoría de los tags. |
| `outlined` | Sin relleno y con una línea fina. | Muchos tags juntos: una columna de una tabla, una lista de categorías. |
| `filled` | Un relleno completo. | El elegido entre sus vecinos: el predeterminado entre varios valores, el obligatorio entre varios campos. También el único estado que no se debe pasar por alto. |

### Estados

`status` es `default`, `info`, `warning`, `error` o `success`. Solo cambia los colores. Un tag outlined conserva el color de texto de la superficie y su línea fina en todos los estados, así que siempre dibuja un punto (o tu glifo) en el color del estado: esa marca es el único lugar donde se ve el estado.

El tag no dibuja por sí solo ningún glifo de estado. Indica uno donde ayude, como hace este sitio con los seis estados de sus propias tablas de estado:

### Tamaños

| `size` | Altura | Texto | Úsalo para |
| --- | --- | --- | --- |
| `small` | 20 | 12 | Junto a la etiqueta de un campo, en una celda de tabla, en una línea de texto de cuerpo. No hace más alta la línea. |
| `medium` (predeterminado) | 24 | 14 | Junto a un encabezado, o por sí solo. |

Los tags de obligatorio y de opcional de un [campo](https://tanrei.chnotchy.com/es/components/field/) y de un [grupo de campos](https://tanrei.chnotchy.com/es/components/field-group/) son este componente en su tamaño pequeño: con relleno para lo obligatorio y tonal para lo opcional. Leen los tokens del tag y no tienen ninguno propio, así que un sistema de diseño que cambia el estilo de sus tags pequeños cambia también el de estos.

### Dentro de algo deshabilitado

Un tag no tiene estados propios, pero puede estar dentro de algo que está deshabilitado: la etiqueta de un campo deshabilitado, una fila deshabilitada de una lista, un elemento deshabilitado de un menú. `disabled` lo dibuja con los colores deshabilitados de su aspecto (`comp.tag.<variant>.disabled.*`), sea cual sea su estado, de modo que se atenúa con lo que lo contiene y no parece la única parte viva de ello. No cambia nada más: el tag conserva su tamaño y sus palabras, y no recibe entrada ni foco. Un campo y un grupo de campos lo activan en su tag de obligatoriedad mientras están deshabilitados; actívalo tú en un tag que pongas dentro de un elemento deshabilitado propio.

### Recomendado

- Di el estado con palabras. «Fallido» no necesita nada más; un tag que dice «3 compilaciones» en los colores de error necesita `statusLabel`.
- Deja a un tag espacio para su etiqueta. Una etiqueta que no cabe se corta con puntos suspensivos, y el tag no tiene estado al pasar el cursor ni de foco con el que mostrar el resto.
- Pon un conjunto de tags en una lista (`<ul>` y `<li>` en la web) y da nombre a la lista cuando formen un solo conjunto, como las categorías de un artículo.

### Evita

- No hagas que un tag se pueda pulsar. Un rótulo que se pulsa, se conmuta o se quita es un chip; uno que lleva a algún sitio es un enlace.
- No uses un tag sin etiqueta. Un punto o un glifo solos no son un tag, y no se dibuja nada.
- No dependas del color para transmitir el estado. Con colores forzados, todos los tags se ven iguales: un borde y una etiqueta en el color del texto.
- No uses un tag para un recuento sobre un icono. Eso es una insignia.

## Accesibilidad

### De qué se encarga el componente

- No tiene rol ni nombre: su etiqueta se lee donde está el tag, como texto. Dentro de un enlace, un botón o una celda de tabla, forma parte del contenido de ese elemento.
- `statusLabel` se lee antes de la etiqueta como una segunda frase («Error, 3 compilaciones») y nunca se dibuja. Se ignora mientras `status` es `default`.
- El glifo y el punto quedan ocultos para la tecnología de apoyo.
- No recibe entrada ni foco, así que no añade ninguna parada al orden del foco ni ningún objetivo a una fila.
- Una etiqueta cortada se sigue leyendo completa.
- Con colores forzados, todos los aspectos ganan un borde en el color del texto, y la etiqueta, el glifo y el punto toman ese color; un tag deshabilitado toma el color del texto deshabilitado.
- `disabled` no expone nada: es el elemento en el que está el tag el que dice que está deshabilitado.
- En un diseño de derecha a izquierda, el glifo o el punto pasan a la derecha de la etiqueta, un glifo que el conjunto de iconos marca para ello se refleja, y una etiqueta escrita de izquierda a derecha conserva su propio orden y se corta por su propio final.
- Las compilaciones de depuración notifican una variante, un tamaño o un estado desconocidos, una etiqueta vacía y un `statusLabel` sin estado.

### Qué debes hacer tú

- Comprueba que las palabras de cada tag digan su estado. El componente no puede saber si «3 compilaciones» es una buena o una mala noticia.
- Escribe `statusLabel` en el idioma de la página.
- Activa `disabled` solo en un tag que esté dentro de algo deshabilitado, y asegúrate de que ese elemento lo dice (un control deshabilitado, o `aria-disabled`): el tag atenuado depende de ello.
- Si un cambio debe anunciarse en el momento en que ocurre (una compilación que termina mientras la persona mira), pon el tag en una región activa (live region) o informa del cambio con un snackbar. El tag no anuncia nada.
