Skip to main content

Examples

Default

Truncated

All Colours

Removable

Props

Tag

A small label for something the user applied, such as a fan tag, a list or an active filter. Status labels belong in Pill or Badge. Pass onRemove to add a × button. The label is plain text, and the × is a real button named by removeLabel, so nothing interactive is nested inside the tag except the ×.
ReactNode
required
The visible label.
ReactNode
Emoji (a string) or icon (an element) displayed before the label. Decorative, so it is hidden from assistive technology. Size an icon yourself: 14px on a 20px tag (className="size-3.5") and 12px on a 16px tag (className="size-3").
((event: MouseEvent<HTMLButtonElement, MouseEvent>) => void)
Renders a remove (×) button when set. Receives the click, so a caller can stop it bubbling. Pass undefined to hide the button conditionally while keeping removeLabel. Leave unset for a tag with no remove button.
string
Accessible name of the remove button, as one translated string such as “Remove Whale”. Only used with onRemove.
"hover" | "always"
default:"always"
"always" keeps the × visible (lists, filter tags). "hover" reveals it on hover or keyboard focus, and keeps it visible on devices that cannot hover. In "hover" mode the tag is narrower at rest and widens when the × appears; its height never changes. Only used with onRemove.
"16" | "20"
default:"20"
Height in pixels: 16 for dense rows, 20 for panels, pickers and filter tags.
"pink" | "red" | "teal" | "green" | "blue" | "gray" | "amber" | "purple"
default:"gray"
Colour from the V2 Tags palette.

Exported types

Also exported from @fanvue/ui: TagProps, TagRemoveVisibility, TagSize, TagVariant.
Setup: Installation · Theming