vaiperui

components / tag

Tag

Label for categories or filters, with an optional remove button.

How to use

`variant` is `filled` or `outline`. Passing `onDismiss` renders a real remove `<button>`; give each one a specific `dismissLabel` so screen readers tell them apart. For semantic status use `Badge`.

preview
DesignCode
ReactNext.jsTailwind
Tag.tsx
import { Tag } from "vaiperui";
<Tag>Design</Tag>
<Tag variant="outline">Code</Tag>
<Tag onDismiss={() => remove("React")} dismissLabel="Remove React">React</Tag>

Variants

preview
filled
filled
outline
outline
variants.tsx
<Tag>filled</Tag>
<Tag variant="outline">outline</Tag>

Colors

preview
primary
primary
success
success
warning
warning
danger
danger
colors.tsx
<Tag variantColor="primary">primary</Tag>
<Tag variantColor="success">success</Tag>
<Tag variantColor="warning">warning</Tag>
<Tag variantColor="danger">danger</Tag>

Sizes

preview
sm
sm
md
md
lg
lg
sizes.tsx
<Tag size="sm">sm</Tag>
<Tag size="md">md</Tag>
<Tag size="lg">lg</Tag>

Custom color

preview
Orange
Orange
Orange
Violet
custom-color.tsx
<Tag customColor="#ff6600" />
<Tag customColor={{ light: "#a855f7", dark: "#fde047" }} />

Props

PropValuesDefaultDescription
variantfilled | outlinefilledTinted background or border only
variantColorprimary | success | warning | dangernoneColor (neutral when omitted)
sizesm | md | lgmdSize of the element and its text
radiusnone | sm | md | lg | fullmdCorner rounding
customColorstring | { light, dark }noneAny CSS color (or a pair per theme) for the tag (overrides variantColor)
onDismiss() => voidnoneRenders a remove button that calls it
dismissLabelstringRemoveAccessible name of the remove button
(native)spannoneEvery native prop of the element, className, ref, etc.