Skip to main content

Tag

A compact, optionally removable chip for filters and token inputs, or a pressable quick-pick chip (onPress). Two attributes carry the highlighted look, and they mean different things: - isSelected on a static tag (renders data-selected="true") — a filter chip that REFLECTS state set elsewhere. - aria-pressed="true" — a control that TOGGLES state; a pressable tag (onPress + isSelected) renders a <button class="prism-tag"> with it. The stylesheet styles both identically. A tag that cannot currently be chosen takes isDisabled (or disabled on a button / aria-disabled="true"); both dim it and set a not-allowed cursor.

Signature
Density
Viewport
Theme and light/dark are set in the top bar
Live demo
Open ↗

When to use​

  • Use it when A removable / selectable keyword or filter chip.
  • Reach for something else when Static status — use Badge.

Accessibility​

Fully keyboard operable: Tab to focus, Enter/Space to activate. The visible focus ring uses --focus-ring — never remove it. Provide an accessible label (aria-label) for icon-only controls.

Install and import​

npx shadcn@latest add @prism/tag
import { Tag } from '@/components/prism/Tag';

In a no-build prototype, read it from the bundle instead: const { Tag } = window.PrismDesignSystem_39d121;

Props​

PropTypeRequiredDescription
isSelectedboolean—Static tag: tints it (data-selected) to reflect state set elsewhere. Pressable tag (onPress): makes it a toggle and sets aria-pressed.
isDisabledboolean—Dims the tag; a pressable tag becomes a disabled button.
onPress(e: React.MouseEvent&lt;HTMLButtonElement&gt;) =&gt; void—Makes it a pressable quick-pick chip (renders a <button>). Can't be combined with onRemove.
onRemove(e: React.MouseEvent&lt;HTMLButtonElement&gt;) =&gt; void—When provided (static tags only), renders a remove (×) button.
removeLabelstring—Accessible verb for the remove button. Default "Remove".
hrefstring—Makes it a link chip (a filter that changes the URL), through LinkProvider. With isSelected it's the current filter (aria-current="page"). Takes precedence over onPress / onRemove — don't combine them.
linkComponentLinkComponent—Overrides LinkProvider's link component for a link tag.
hue"rose" | "orange" | "amber" | "green" | "teal" | "blue" | "violet" | "magenta"—Tints the chip in a categorical hue; selected, it fills with the hue.
variant"default" | "chip"—"chip": a read-only label chip — smaller and quieter, never interactive, not a status (use Badge for that). Ignores onPress / href / onRemove.
childrenReact.ReactNode—
classNamestring—