Tag
A one-line label for a category or a value that can also be removed, pressed, followed or selected.
import { Tag, TagGroup } from '@slotted/react/tag';export default function TagBasic() { return ( <TagGroup aria-label="Labels on order SO-10482" role="list"> <Tag>Wholesale</Tag> <Tag>Fragile</Tag> <Tag>Priority shipping</Tag> </TagGroup> );}Installation
The packages are a 0.x beta on npm, and their public API changes between beta releases without deprecation. One line installs the binding and the default theme.
pnpm add @slotted/react @slotted/theme @slotted/themesTag or badge
A tag names a category, a filter or a value, such as the labels on an order. A badge states a status or a count and is never interactive; a tag can be removed (Tag), run a command (TagButton), navigate (TagLink) or hold a selection (TagToggle). A run of static tags written as role="list" announces its length and takes no arrow-key navigation.
Tone and variant
tone picks the semantic color: accent, secondary, info, success, warning or danger. variant picks how the tone is painted: solid fills the tag, soft tints it, outline draws the edge alone and dashed draws that edge in dashes. The default is secondary and soft. Pair the color with words, because color alone is not a signal.
import { Inline } from '@slotted/react/inline';import { Stack } from '@slotted/react/stack';import { Tag } from '@slotted/react/tag';const VARIANTS = ['solid', 'soft', 'outline', 'dashed'] as const;const TONES = [ { tone: 'accent', label: 'Accent' }, { tone: 'secondary', label: 'Secondary' }, { tone: 'info', label: 'Info' }, { tone: 'success', label: 'Success' }, { tone: 'warning', label: 'Warning' }, { tone: 'danger', label: 'Danger' },] as const;export default function TagAppearance() { return ( <Stack gap={3}> {VARIANTS.map((variant) => ( <Inline key={variant} gap={2}> {TONES.map(({ tone, label }) => ( <Tag key={tone} tone={tone} variant={variant}> {label} </Tag> ))} </Inline> ))} </Stack> );}Sizes and shapes
size takes the control scale: sm, md and lg. A tag shrinks and grows with the controls it sits beside. shape is pill, a fully rounded chip, or square, a rectangle with the small corner radius.
import { Inline } from '@slotted/react/inline';import { Stack } from '@slotted/react/stack';import { Tag } from '@slotted/react/tag';const SIZES = [ { size: 'sm', label: 'Small' }, { size: 'md', label: 'Medium' }, { size: 'lg', label: 'Large' },] as const;const SHAPES = ['pill', 'square'] as const;export default function TagSizes() { return ( <Stack gap={3}> {SHAPES.map((shape) => ( <Inline key={shape} align="center" gap={2}> {SIZES.map(({ size, label }) => ( <Tag key={size} shape={shape} size={size} tone="success"> {label} </Tag> ))} </Inline> ))} </Stack> );}Beside a title
A tag is taller than a line of text at the same size, so a title that carries one grows its row. inline draws the tag inside the line: the line keeps its height and the text under it keeps its distance. Two items of a list, one with a tag and one without, stand at the same height.
Glyphs
A glyph goes before or after the label: the start and end props in React, and an element carrying slTagStart or slTagEnd inside slTagBody in Angular. The part sizes and centers the glyph.
import { Glyph } from '@slotted/react/icon';import { Inline } from '@slotted/react/inline';import { Tag } from '@slotted/react/tag';export default function TagContent() { return ( <Inline gap={2}> <Tag start={<Glyph name="clock" />} tone="warning"> Due Friday </Tag> <Tag end={<Glyph name="lock" />}>Contract price</Tag> <Tag end={<Glyph name="circle-check" />} start={<Glyph name="pin" />} tone="success"> Verified address </Tag> </Inline> );}Removing a tag
In React a tag is removable when it receives onRemove, which also renders the remove control. In Angular a tag is removable when it carries removable, and a button with slTagRemove draws the control; the remove output emits the request. Removing is a request, not a change: the application drops the value from its own list. The control is named from messages.remove and the tag’s label, so it reads “Remove Fragile”. Backspace and Delete on a focused control inside the tag ask for the same removal. Remove tags here with the mouse, then with the keyboard.
import { Tag, TagGroup } from '@slotted/react/tag';import { Text } from '@slotted/react/typography';import { useState } from 'react';const LABELS = ['Wholesale', 'Fragile', 'Priority shipping', 'Gift wrap'];export default function TagRemoval() { const [labels, setLabels] = useState(LABELS); function handleRemove(label: string) { setLabels((current) => current.filter((item) => item !== label)); } return ( <> <TagGroup aria-label="Labels on order SO-10482"> {labels.map((label) => ( <Tag key={label} onRemove={() => handleRemove(label)}> {label} </Tag> ))} </TagGroup> {labels.length === 0 && ( <Text size="sm" tone="muted"> No labels on this order. </Text> )} </> );}Confirming a removal
The request carries reason, remove for the control and keyboard for Backspace or Delete, and cancel(). Calling cancel() refuses the removal and the group leaves focus where it is, so the application can ask first. In this example the tag stays until the person confirms, and the message states how the removal was requested.
import { Button } from '@slotted/react/button';import { Inline } from '@slotted/react/inline';import { Stack } from '@slotted/react/stack';import { Tag, TagGroup } from '@slotted/react/tag';import type { TagRemoveReason, TagRemoveRequest } from '@slotted/react/tag';import { Text } from '@slotted/react/typography';import { useState } from 'react';export default function TagConfirm() { const [reason, setReason] = useState<TagRemoveReason | null>(null); const [removed, setRemoved] = useState(false); const via = reason === 'keyboard' ? 'Backspace or Delete' : 'the remove control'; function handleRemove(request: TagRemoveRequest) { request.cancel(); setReason(request.reason); } function handleConfirm() { setRemoved(true); setReason(null); } return ( <Stack gap={3}> <TagGroup aria-label="Environments of the release rule"> {!removed && ( <Tag onRemove={handleRemove} tone="danger" variant="outline"> Production </Tag> )} <Tag>Staging</Tag> </TagGroup> {reason !== null && ( <Stack gap={2}> <Text size="sm">Remove Production from this rule? Requested with {via}.</Text> <Inline gap={2}> <Button onClick={handleConfirm}>Remove</Button> <Button onClick={() => setReason(null)} variant="outline"> Keep </Button> </Inline> </Stack> )} </Stack> );}Disabled and refused removal
disabled refuses every interaction the tag offers, its removal included, and sets data-disabled on the tag. A disabled TagButton is natively disabled. A disabled TagLink loses its href and announces aria-disabled, because an anchor without a destination is not a link. removeDisabled refuses only the removal and leaves the rest of the tag operable.
import { Inline } from '@slotted/react/inline';import { Tag, TagButton, TagLink } from '@slotted/react/tag';export default function TagStates() { return ( <Inline gap={2}> <Tag disabled onRemove={() => undefined}> Archived </Tag> <Tag onRemove={() => undefined} removeDisabled> Required </Tag> <TagButton disabled>Assign owner</TagButton> <TagLink disabled href="#carrier-portal"> Carrier portal </TagLink> </Inline> );}Commands and links
TagButton runs a command on the button that is the tag’s body. TagLink navigates on a real anchor, so middle click and “open in new tab” keep working. In Angular the element carrying slTagBody decides which one the tag is: a span does nothing, a button runs a command and an a navigates. Here the carriers link to their own pages and the last tag reveals the rest of the list.
import { TagButton, TagGroup, TagLink } from '@slotted/react/tag';import { useState } from 'react';const CARRIERS = [ { name: 'Northwind Freight', href: '#northwind-freight' }, { name: 'Harbor Line', href: '#harbor-line' }, { name: 'Blue Route', href: '#blue-route' }, { name: 'Summit Cargo', href: '#summit-cargo' }, { name: 'Delta Parcel', href: '#delta-parcel' },];export default function TagActions() { const [expanded, setExpanded] = useState(false); const shown = expanded ? CARRIERS : CARRIERS.slice(0, 3); const hidden = CARRIERS.length - 3; return ( <TagGroup aria-label="Carriers on route 14"> {shown.map((carrier) => ( <TagLink key={carrier.name} href={carrier.href}> {carrier.name} </TagLink> ))} <TagButton onClick={() => setExpanded(!expanded)} variant="outline"> {expanded ? 'Show fewer' : `+${hidden} more`} </TagButton> </TagGroup> );}Selection
TagToggle holds a selection and exposes it as aria-pressed. A selected tag fills and draws a check before the label, so the state is not color alone. defaultSelected sets the starting state of an uncontrolled toggle, which keeps its own selection. A disabled toggle takes no press.
import { TagGroup, TagToggle } from '@slotted/react/tag';export default function TagSelection() { return ( <TagGroup aria-label="Order status"> <TagToggle defaultSelected tone="accent"> Open </TagToggle> <TagToggle tone="accent">Packed</TagToggle> <TagToggle tone="accent">Shipped</TagToggle> <TagToggle disabled tone="accent"> Cancelled </TagToggle> </TagGroup> );}Controlled filters
Pass selected to own the selection. A press calls onSelectedChange in React and emits selectedChange in Angular, and the tag moves only when the new value is passed back. In Angular the request exposes the new value as $event.value. A toggle can also be removable: here each filter leaves the bar with its control or with Backspace.
import { Stack } from '@slotted/react/stack';import { TagGroup, TagToggle } from '@slotted/react/tag';import { Text } from '@slotted/react/typography';import { useState } from 'react';const FACETS = ['Late', 'Backordered', 'Fragile', 'Gift wrap'];export default function TagFilters() { const [facets, setFacets] = useState(FACETS); const [chosen, setChosen] = useState(['Late']); function handleSelect(facet: string, selected: boolean) { setChosen((current) => selected ? [...current, facet] : current.filter((item) => item !== facet), ); } function handleRemove(facet: string) { setFacets((current) => current.filter((item) => item !== facet)); setChosen((current) => current.filter((item) => item !== facet)); } return ( <Stack gap={3}> <TagGroup aria-label="Order filters"> {facets.map((facet) => ( <TagToggle key={facet} onRemove={() => handleRemove(facet)} onSelectedChange={(selected) => handleSelect(facet, selected)} selected={chosen.includes(facet)} tone="accent" > {facet} </TagToggle> ))} </TagGroup> <Text size="sm" tone="muted"> {chosen.length} of {facets.length} filters applied. </Text> </Stack> );}Groups
TagGroup is a toolbar by default: one tab stop, and the arrow keys move between the controls inside it, each tag’s body and then its remove control. orientation="vertical" changes the keys to up and down and writes aria-orientation. loop={false} in React and [loop]="false" in Angular stops the arrow keys at the ends of the run instead of wrapping.
import { TagButton, TagGroup } from '@slotted/react/tag';export default function TagGroupExample() { return ( <TagGroup aria-label="Saved order views" loop={false} orientation="vertical"> <TagButton>All orders</TagButton> <TagButton>Late deliveries</TagButton> <TagButton>Awaiting payment</TagButton> <TagButton>Returns in transit</TagButton> </TagGroup> );}Defaults
A defaults provider sets tone, variant, size and shape once for every tag under it: TagDefaultsProvider in React, provideTagDefaults in Angular. A tag that sets a prop of its own keeps it.
import { Inline } from '@slotted/react/inline';import { Tag, TagDefaultsProvider } from '@slotted/react/tag';export default function TagDefaults() { return ( <TagDefaultsProvider shape="square" size="sm"> <Inline gap={2}> <Tag>Inbound</Tag> <Tag>Cross-dock</Tag> <Tag shape="pill" size="md"> Cold chain </Tag> </Inline> </TagDefaultsProvider> );}Accessibility
tag
- The WAI-ARIA Authoring Practices define no tag or chip pattern. The group follows the Toolbar pattern, a chip that acts and the remove control follow the Button pattern, a chip that navigates follows the Link pattern, and a chip that holds a selection uses aria-pressed from WAI-ARIA 1.2.
- The chip box is never the interactive element. A button cannot contain a button and an anchor cannot contain either, so a chip that both acts and removes puts its two controls side by side: the body is the primary target and the remove control is its sibling.
- The remove control’s name is composed, not repeated: aria-labelledby joins a hidden word to the tag’s own label, so it announces “Remove Design” rather than “Remove”. Text referenced by aria-labelledby counts even when the element holding it is hidden.
- Backspace and Delete on any control inside a removable tag ask for the same removal the X does, and the request says which of the two it was.
- The focus ring is drawn on the control, never on the chip: a chip can hold two controls, and a ring around the whole box could not say which one has focus. The ring is inset, so it does not cover the remove control beside the body or touch the next tag in a wrapped run.
- The remove control is as tall as the chip and as wide as its glyph plus a step of air on each side, floored at the WCAG 2.2 2.5.8 minimum of 24 CSS pixels, which carries it past that minimum in both axes at every size and every density. The chip’s own height is floored at that minimum for the same reason.
- A tag is one line. A value too long for its container is clipped with an ellipsis rather than reflowed, and the clipping is visual only: text-overflow shortens nothing, so the whole value stays in the DOM, stays in the accessibility tree, and a page search still finds it.
- The label is a bidi isolate whose direction comes from its own first strong character, so an Arabic value inside an English page reads right to left and is clipped at its own end.
- Under forced colors every tone ground becomes one system color, so tag draws its edge in currentColor there, and a selected chip takes the system’s own Highlight pair — its whole signal is a ground the system has replaced.
- A static tag carries no role of its own. What a value means comes from where it sits, and a role invented here would be wrong more often than right.
- A group of static tags is written role="list", which announces its length and turns the arrow keys off — a list is a structure rather than a widget.
tagButton
- The WAI-ARIA Authoring Practices define no tag or chip pattern. The group follows the Toolbar pattern, a chip that acts and the remove control follow the Button pattern, a chip that navigates follows the Link pattern, and a chip that holds a selection uses aria-pressed from WAI-ARIA 1.2.
- The chip box is never the interactive element. A button cannot contain a button and an anchor cannot contain either, so a chip that both acts and removes puts its two controls side by side: the body is the primary target and the remove control is its sibling.
- The remove control’s name is composed, not repeated: aria-labelledby joins a hidden word to the tag’s own label, so it announces “Remove Design” rather than “Remove”. Text referenced by aria-labelledby counts even when the element holding it is hidden.
- Backspace and Delete on any control inside a removable tag ask for the same removal the X does, and the request says which of the two it was.
- The focus ring is drawn on the control, never on the chip: a chip can hold two controls, and a ring around the whole box could not say which one has focus. The ring is inset, so it does not cover the remove control beside the body or touch the next tag in a wrapped run.
- The remove control is as tall as the chip and as wide as its glyph plus a step of air on each side, floored at the WCAG 2.2 2.5.8 minimum of 24 CSS pixels, which carries it past that minimum in both axes at every size and every density. The chip’s own height is floored at that minimum for the same reason.
- A tag is one line. A value too long for its container is clipped with an ellipsis rather than reflowed, and the clipping is visual only: text-overflow shortens nothing, so the whole value stays in the DOM, stays in the accessibility tree, and a page search still finds it.
- The label is a bidi isolate whose direction comes from its own first strong character, so an Arabic value inside an English page reads right to left and is clipped at its own end.
- Under forced colors every tone ground becomes one system color, so tag draws its edge in currentColor there, and a selected chip takes the system’s own Highlight pair — its whole signal is a ground the system has replaced.
- The command is a real button, so Enter and Space both activate it and the platform supplies the rest.
- A disabled TagButton is natively disabled. Reach for aria-disabled through rootProps only when the chip has to stay in the tab sequence to explain itself.
tagLink
- The WAI-ARIA Authoring Practices define no tag or chip pattern. The group follows the Toolbar pattern, a chip that acts and the remove control follow the Button pattern, a chip that navigates follows the Link pattern, and a chip that holds a selection uses aria-pressed from WAI-ARIA 1.2.
- The chip box is never the interactive element. A button cannot contain a button and an anchor cannot contain either, so a chip that both acts and removes puts its two controls side by side: the body is the primary target and the remove control is its sibling.
- The remove control’s name is composed, not repeated: aria-labelledby joins a hidden word to the tag’s own label, so it announces “Remove Design” rather than “Remove”. Text referenced by aria-labelledby counts even when the element holding it is hidden.
- Backspace and Delete on any control inside a removable tag ask for the same removal the X does, and the request says which of the two it was.
- The focus ring is drawn on the control, never on the chip: a chip can hold two controls, and a ring around the whole box could not say which one has focus. The ring is inset, so it does not cover the remove control beside the body or touch the next tag in a wrapped run.
- The remove control is as tall as the chip and as wide as its glyph plus a step of air on each side, floored at the WCAG 2.2 2.5.8 minimum of 24 CSS pixels, which carries it past that minimum in both axes at every size and every density. The chip’s own height is floored at that minimum for the same reason.
- A tag is one line. A value too long for its container is clipped with an ellipsis rather than reflowed, and the clipping is visual only: text-overflow shortens nothing, so the whole value stays in the DOM, stays in the accessibility tree, and a page search still finds it.
- The label is a bidi isolate whose direction comes from its own first strong character, so an Arabic value inside an English page reads right to left and is clipped at its own end.
- Under forced colors every tone ground becomes one system color, so tag draws its edge in currentColor there, and a selected chip takes the system’s own Highlight pair — its whole signal is a ground the system has replaced.
- The destination is a real anchor, so middle click, the context menu, download and “open in new tab” all keep working.
- A chip that navigates to another origin says so in its own words or in a visually hidden sentence. The external marker belongs to the link family, on a link.
tagToggle
- The WAI-ARIA Authoring Practices define no tag or chip pattern. The group follows the Toolbar pattern, a chip that acts and the remove control follow the Button pattern, a chip that navigates follows the Link pattern, and a chip that holds a selection uses aria-pressed from WAI-ARIA 1.2.
- The chip box is never the interactive element. A button cannot contain a button and an anchor cannot contain either, so a chip that both acts and removes puts its two controls side by side: the body is the primary target and the remove control is its sibling.
- The remove control’s name is composed, not repeated: aria-labelledby joins a hidden word to the tag’s own label, so it announces “Remove Design” rather than “Remove”. Text referenced by aria-labelledby counts even when the element holding it is hidden.
- Backspace and Delete on any control inside a removable tag ask for the same removal the X does, and the request says which of the two it was.
- The focus ring is drawn on the control, never on the chip: a chip can hold two controls, and a ring around the whole box could not say which one has focus. The ring is inset, so it does not cover the remove control beside the body or touch the next tag in a wrapped run.
- The remove control is as tall as the chip and as wide as its glyph plus a step of air on each side, floored at the WCAG 2.2 2.5.8 minimum of 24 CSS pixels, which carries it past that minimum in both axes at every size and every density. The chip’s own height is floored at that minimum for the same reason.
- A tag is one line. A value too long for its container is clipped with an ellipsis rather than reflowed, and the clipping is visual only: text-overflow shortens nothing, so the whole value stays in the DOM, stays in the accessibility tree, and a page search still finds it.
- The label is a bidi isolate whose direction comes from its own first strong character, so an Arabic value inside an English page reads right to left and is clipped at its own end.
- Under forced colors every tone ground becomes one system color, so tag draws its edge in currentColor there, and a selected chip takes the system’s own Highlight pair — its whole signal is a ground the system has replaced.
- A selected tag announces aria-pressed, not aria-selected. aria-selected is only valid inside a listbox, a grid or a tree, and an option may not contain the remove control that tag puts beside the label.
- The label never changes with the state, which is the APG’s rule for a toggle: “Open” stays “Open” and the state is announced beside it.
- Selection is not color alone. The chip fills, and a check grows into the label beside the words — WCAG 2.2 1.4.1.
API
tag
Props
tone'accent' | 'secondary' | 'info' | 'success' | 'warning' | 'danger'Defaultsecondary- Which of the six semantic colors the tag speaks in
variant'solid' | 'soft' | 'outline' | 'dashed'Defaultsoft- How that color is painted: filled, tinted, an edge alone, or that edge in dashes. A selected tag fills whatever its variant
size'sm' | 'md' | 'lg'Defaultmd- Type, glyph and gap come from the control scale, so a tag shrinks with density beside the controls it sits with
shape'pill' | 'square'Defaultpill- A rounded chip, or a rectangle with the small corner radius
inlinebooleanDefaultfalse- No taller than the line of text around it, for a title or a sentence: the line keeps its height and what is under it its distance. The tag takes its own size where the line has the room and one line of the text where it does not; its words are at most nine tenths of the text around it.
startReactNode- A glyph or an avatar before the words, wrapped in the start part, which sizes and centers it
endReactNode- A glyph after the words, wrapped in the end part
disabledbooleanDefaultfalse- Refuses every interaction the tag offers, including its removal
onRemove(request: TagRemoveRequest) => void- Asks to be removed. The remove control is rendered only when this is present. request.reason is remove for the control and keyboard for Backspace or Delete; request.cancel() refuses it, and the group then leaves focus where it is
messagesPartial<TagMessages>- Overrides for the strings of the language in force, by key: remove is the word the remove control announces before the tag’s own label, so it reads “Remove Design”
removeDisabledbooleanDefaultfalse- Refuses the removal while the rest of the tag stays operable
orientation'horizontal' | 'vertical'Defaulthorizontal- On TagGroupWhich way the run reads. vertical also writes aria-orientation
loopbooleanDefaulttrue- On TagGroupWhether the arrow keys wrap past the ends of the run
rolestringDefaulttoolbar- On TagGrouptoolbar makes the run one tab stop with arrow navigation inside it. Writing list turns that off and gives every chip role="listitem"
render(props) => ReactNode- On every memberRenders the member’s own element into another one — an li for a tag in a list, a router’s link component for a destination
rootPropsComponentProps<'span'>- On TagButton, TagLink, TagToggleReaches the chip box, which an interactive member’s own props do not land on
refRef<HTMLElement>- On every memberReaches the element the member is: the chip box for Tag, the control for the other three
TagDefaultsProvider{ tone, variant, size, shape }- On a subtreeSets the defaults once for every tag under it; an explicit prop still wins
tagButton
Props
tone'accent' | 'secondary' | 'info' | 'success' | 'warning' | 'danger'Defaultsecondary- Which of the six semantic colors the tag speaks in
variant'solid' | 'soft' | 'outline' | 'dashed'Defaultsoft- How that color is painted: filled, tinted, an edge alone, or that edge in dashes. A selected tag fills whatever its variant
size'sm' | 'md' | 'lg'Defaultmd- Type, glyph and gap come from the control scale, so a tag shrinks with density beside the controls it sits with
shape'pill' | 'square'Defaultpill- A rounded chip, or a rectangle with the small corner radius
startReactNode- A glyph or an avatar before the words, wrapped in the start part, which sizes and centers it
endReactNode- A glyph after the words, wrapped in the end part
disabledbooleanDefaultfalse- Refuses every interaction the tag offers, including its removal
onRemove(request: TagRemoveRequest) => void- Asks to be removed. The remove control is rendered only when this is present. request.reason is remove for the control and keyboard for Backspace or Delete; request.cancel() refuses it, and the group then leaves focus where it is
messagesPartial<TagMessages>- Overrides for the strings of the language in force, by key: remove is the word the remove control announces before the tag’s own label, so it reads “Remove Design”
removeDisabledbooleanDefaultfalse- Refuses the removal while the rest of the tag stays operable
onClick(event) => void- The command. It lands on the button the chip’s body is, so type, form and every native button prop reach the element that owns them
tagLink
Props
tone'accent' | 'secondary' | 'info' | 'success' | 'warning' | 'danger'Defaultsecondary- Which of the six semantic colors the tag speaks in
variant'solid' | 'soft' | 'outline' | 'dashed'Defaultsoft- How that color is painted: filled, tinted, an edge alone, or that edge in dashes. A selected tag fills whatever its variant
size'sm' | 'md' | 'lg'Defaultmd- Type, glyph and gap come from the control scale, so a tag shrinks with density beside the controls it sits with
shape'pill' | 'square'Defaultpill- A rounded chip, or a rectangle with the small corner radius
startReactNode- A glyph or an avatar before the words, wrapped in the start part, which sizes and centers it
endReactNode- A glyph after the words, wrapped in the end part
disabledbooleanDefaultfalse- Refuses every interaction the tag offers, including its removal
onRemove(request: TagRemoveRequest) => void- Asks to be removed. The remove control is rendered only when this is present. request.reason is remove for the control and keyboard for Backspace or Delete; request.cancel() refuses it, and the group then leaves focus where it is
messagesPartial<TagMessages>- Overrides for the strings of the language in force, by key: remove is the word the remove control announces before the tag’s own label, so it reads “Remove Design”
removeDisabledbooleanDefaultfalse- Refuses the removal while the rest of the tag stays operable
hrefstring- The destination. A disabled TagLink loses it and announces aria-disabled, because an anchor without a destination is not a link
tagToggle
Props
tone'accent' | 'secondary' | 'info' | 'success' | 'warning' | 'danger'Defaultsecondary- Which of the six semantic colors the tag speaks in
variant'solid' | 'soft' | 'outline' | 'dashed'Defaultsoft- How that color is painted: filled, tinted, an edge alone, or that edge in dashes. A selected tag fills whatever its variant
size'sm' | 'md' | 'lg'Defaultmd- Type, glyph and gap come from the control scale, so a tag shrinks with density beside the controls it sits with
shape'pill' | 'square'Defaultpill- A rounded chip, or a rectangle with the small corner radius
startReactNode- A glyph or an avatar before the words, wrapped in the start part, which sizes and centers it
endReactNode- A glyph after the words, wrapped in the end part
disabledbooleanDefaultfalse- Refuses every interaction the tag offers, including its removal
onRemove(request: TagRemoveRequest) => void- Asks to be removed. The remove control is rendered only when this is present. request.reason is remove for the control and keyboard for Backspace or Delete; request.cancel() refuses it, and the group then leaves focus where it is
messagesPartial<TagMessages>- Overrides for the strings of the language in force, by key: remove is the word the remove control announces before the tag’s own label, so it reads “Remove Design”
removeDisabledbooleanDefaultfalse- Refuses the removal while the rest of the tag stays operable
selectedbooleanDefaultfalse- The selection the consumer owns. Passing it puts the tag in controlled mode for good
defaultSelectedboolean- The selection an uncontrolled tag starts from, read once. A later change to it is not silently adopted
onSelectedChange(selected, request) => void- Asks for the opposite selection. request.reason is pointer or keyboard, and request.cancel() refuses it
Theming
Each token is a CSS custom property: set it in a theme, or on any element to retune every tag inside it.
Tag tokens
| Token | Default |
|---|---|
--slotted-tag-border-color | var(--slotted-tone-secondary-border) |
--slotted-tag-border-width | var(--slotted-border-width-thin, 1px) |
--slotted-tag-font-family | var(--slotted-control-font-family, sans-serif) |
--slotted-tag-font-weight | var(--slotted-font-weight-medium, 500) |
--slotted-tag-group-gap | var(--slotted-space-2, 0.25rem) |
--slotted-tag-inset-block | var(--slotted-space-2, 0.25rem) |
--slotted-tag-inset-inline | var(--slotted-space-4, 0.5rem) |
--slotted-tag-state-layer-active | 14% |
--slotted-tag-state-layer-hover | 8% |
Theme tokens it reads
| Token | Default |
|---|---|
--slotted-border-width-thin | 1px |
--slotted-control-font-family | var(--slotted-font-family-sans) |
--slotted-control-font-size-lg | comfortable 14px · compact 13px · dense 12px |
--slotted-control-font-size-md | comfortable 13px · compact 12px · dense 12px |
--slotted-control-font-size-sm | comfortable 12px · compact 12px · dense 12px |
--slotted-control-icon-size-md | comfortable 16px · compact 14px · dense 13px |
--slotted-control-icon-size-sm | comfortable 14px · compact 13px · dense 12px |
--slotted-control-inner-size | var(--_own-size) |
--slotted-control-inner-size-md | comfortable 24px · compact 20px · dense 18px |
--slotted-control-inner-size-sm | comfortable 22px · compact 18px · dense 16px |
--slotted-control-transition-duration | var(--slotted-duration-short) |
--slotted-control-transition-easing | var(--slotted-easing-standard) |
--slotted-disabled-background | Set per scheme by the theme |
--slotted-disabled-border | Set per scheme by the theme |
--slotted-disabled-foreground | Set per scheme by the theme |
--slotted-duration-short | 120ms |
--slotted-easing-standard | cubic-bezier(0.2, 0, 0, 1) |
--slotted-focus-ring-color | Set per scheme by the theme |
--slotted-focus-ring-offset | var(--slotted-border-width-thick) |
--slotted-focus-ring-width | var(--slotted-border-width-thick) |
--slotted-font-weight-medium | 500 |
--slotted-line-height-xs | 1.4 |
--slotted-radius-full | 9999px |
--slotted-radius-sm | 4px |
--slotted-space-1 | 0.125rem |
--slotted-space-2 | 0.25rem |
--slotted-space-3 | 0.375rem |
--slotted-space-4 | 0.5rem |
--slotted-space-5 | 0.75rem |
--slotted-target-comfortable | 44px |
--slotted-target-min | 24px |
--slotted-text-box-edge | cap alphabetic |
--slotted-tone-accent-border | Set per scheme by the theme |
--slotted-tone-accent-on-solid | Set per scheme by the theme |
--slotted-tone-accent-solid | Set per scheme by the theme |
--slotted-tone-accent-solid-active | Set per scheme by the theme |
--slotted-tone-accent-solid-hover | Set per scheme by the theme |
--slotted-tone-accent-subtle-active | Set per scheme by the theme |
--slotted-tone-accent-subtle-hover | Set per scheme by the theme |
--slotted-tone-accent-surface | Set per scheme by the theme |
--slotted-tone-accent-text | Set per scheme by the theme |
--slotted-tone-danger-border | Set per scheme by the theme |
--slotted-tone-danger-on-solid | Set per scheme by the theme |
--slotted-tone-danger-solid | Set per scheme by the theme |
--slotted-tone-danger-solid-active | Set per scheme by the theme |
--slotted-tone-danger-solid-hover | Set per scheme by the theme |
--slotted-tone-danger-subtle-active | Set per scheme by the theme |
--slotted-tone-danger-subtle-hover | Set per scheme by the theme |
--slotted-tone-danger-surface | Set per scheme by the theme |
--slotted-tone-danger-text | Set per scheme by the theme |
--slotted-tone-info-border | Set per scheme by the theme |
--slotted-tone-info-on-solid | Set per scheme by the theme |
--slotted-tone-info-solid | Set per scheme by the theme |
--slotted-tone-info-solid-active | Set per scheme by the theme |
--slotted-tone-info-solid-hover | Set per scheme by the theme |
--slotted-tone-info-subtle-active | Set per scheme by the theme |
--slotted-tone-info-subtle-hover | Set per scheme by the theme |
--slotted-tone-info-surface | Set per scheme by the theme |
--slotted-tone-info-text | Set per scheme by the theme |
--slotted-tone-secondary-border | Set per scheme by the theme |
--slotted-tone-secondary-on-solid | Set per scheme by the theme |
--slotted-tone-secondary-solid-active | Set per scheme by the theme |
--slotted-tone-secondary-solid-hover | Set per scheme by the theme |
--slotted-tone-secondary-subtle-active | Set per scheme by the theme |
--slotted-tone-secondary-subtle-hover | Set per scheme by the theme |
--slotted-tone-secondary-surface | Set per scheme by the theme |
--slotted-tone-secondary-text | Set per scheme by the theme |
--slotted-tone-success-border | Set per scheme by the theme |
--slotted-tone-success-on-solid | Set per scheme by the theme |
--slotted-tone-success-solid | Set per scheme by the theme |
--slotted-tone-success-solid-active | Set per scheme by the theme |
--slotted-tone-success-solid-hover | Set per scheme by the theme |
--slotted-tone-success-subtle-active | Set per scheme by the theme |
--slotted-tone-success-subtle-hover | Set per scheme by the theme |
--slotted-tone-success-surface | Set per scheme by the theme |
--slotted-tone-success-text | Set per scheme by the theme |
--slotted-tone-warning-border | Set per scheme by the theme |
--slotted-tone-warning-on-solid | Set per scheme by the theme |
--slotted-tone-warning-solid | Set per scheme by the theme |
--slotted-tone-warning-solid-active | Set per scheme by the theme |
--slotted-tone-warning-solid-hover | Set per scheme by the theme |
--slotted-tone-warning-subtle-active | Set per scheme by the theme |
--slotted-tone-warning-subtle-hover | Set per scheme by the theme |
--slotted-tone-warning-surface | Set per scheme by the theme |
--slotted-tone-warning-text | Set per scheme by the theme |