Skip to Content
⭐️ Leave a star →
ComponentsTag

Tag

A compact label. Use it for status pills, filter chips, or inline tags. The optional Remove sub-component is a native <button> with full interactive state tracking.

Features

Three composable parts: Root, Label, Remove.
Remove tracks hover, focus, active, and disabled via data attributes.
Disabled state on Root applies data-disabled for styling.
Remove defaults to a sensible aria-label for screen readers.

Example

activedraftarchived
ReactVueSolid
import { Tag } from '@wire-ui/react' <Tag.Root> <Tag.Label>React</Tag.Label> <Tag.Remove onClick={() => remove('react')}>×</Tag.Remove> </Tag.Root>

Styling

Tag.Root exposes data-disabled when disabled is true. Tag.Remove tracks the full set of interactive states (data-hover, data-focus-visible, data-active) via data attributes.

<Tag.Root disabled className=" data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed "> <Tag.Label>archived</Tag.Label> </Tag.Root> <Tag.Remove className=" [data-hover]:bg-[#e5e5e5] [data-focus-visible]:ring-2 [data-focus-visible]:ring-black [data-active]:scale-95 "> × </Tag.Remove>

Using data attributes

Tag.Root sets data-disabled when disabled. Tag.Remove exposes the same interactive-state attributes as Button.

[data-disabled] { opacity: 0.5; cursor: not-allowed; } [data-hover] { background: #e5e5e5; } [data-focus-visible] { outline: 2px solid black; } [data-active] { transform: scale(0.95); }

Root props

PropTypeDefaultDescription
disabledbooleanfalseDisabled state — adds data-disabled
...restHTMLAttributes<HTMLSpanElement>All standard HTML span attributes

Label props

PropTypeDescription
...restHTMLAttributes<HTMLSpanElement>All standard HTML span attributes

Remove props

PropTypeDefaultDescription
aria-labelstring'Remove'Accessible label for the remove button
...restButtonHTMLAttributes<HTMLButtonElement>All standard HTML button attributes

Data attributes

AttributeElementWhen present
data-disabledRootdisabled prop is true
data-hoverRemoveMouse is over the remove button
data-focus-visibleRemoveRemove has keyboard focus
data-activeRemoveRemove is being pressed

Accessibility

  • Remove renders as a <button type="button"> with a sensible default aria-label="Remove" — always pass a more specific label when possible (e.g. aria-label="Remove React").
  • Root is a <span> with no inherent semantics — wrap with a list or container if your tags belong to a logical group.

Keyboard Interactions

KeyDescription
TabMoves focus to the Remove button.
SpaceActivates the Remove button.
EnterActivates the Remove button.
Last updated on

MIT License © 2026 wire-ui

Tag – Wire UI