Thrive Design System

Components

Tag

A compact label element for categorizing, filtering, or displaying metadata with optional close functionality.

Installation

npm install @thrivecart/ui
yarn add @thrivecart/ui
pnpm add @thrivecart/ui
bun add @thrivecart/ui

Usage

import { Tag } from '@thrivecart/ui';

Examples

Basic

Basic Tags

Simple text tags

Small
Medium - Default
Large
<div className="flex flex-wrap gap-2">
<Tag size="sm">Small</Tag>
<Tag size="md">Medium - Default</Tag>
<Tag size="lg">Large</Tag>
</div>

With Icons

Tags with Icons

Tags with start or end icon elements

Contact
Featured
Category
<div className="flex flex-wrap gap-2">
<Tag startElement={<MdPerson className="size-4" />} size="sm">Contact</Tag>
<Tag startElement={<MdStar className="size-5" />}>Featured</Tag>
<Tag startElement={<MdLabel className="size-5" />} size="lg">Category</Tag>
</div>

With Avatar

Use startElement to pass an avatar or any custom element before the text.

Avatar Tags

Tags with user avatars via startElement

JD
John Doe
JS
Jane Smith
AL
Alex
<div className="flex flex-wrap gap-2">
<Tag size="lg" startElement={
  <Avatar size="sm">
    <AvatarImage src="https://i.pravatar.cc/48?img=1" alt="John Doe" />
    <AvatarFallback>JD</AvatarFallback>
  </Avatar>
}>
  John Doe
</Tag>
<Tag size="md" startElement={
  <Avatar size="sm">
    <AvatarImage src="https://i.pravatar.cc/48?img=2" alt="Jane Smith" />
    <AvatarFallback>JS</AvatarFallback>
  </Avatar>
}>
  Jane Smith
</Tag>
<Tag size="sm" startElement={
  <Avatar size="xs">
    <AvatarImage src="https://i.pravatar.cc/48?img=3" alt="Alex" />
    <AvatarFallback>AL</AvatarFallback>
  </Avatar>
}>
  Alex
</Tag>
</div>

Closable

Removable Tags

Tags with a close button for filter removal

Removable
Large Tag
Small Tag
With Icon
<div className="flex flex-wrap gap-2">
<Tag closable>Removable</Tag>
<Tag closable size="lg">Large Tag</Tag>
<Tag closable size="sm">Small Tag</Tag>
<Tag closable startElement={<MdLabel className="size-5" />}>With Icon</Tag>
</div>

Disabled

Disabled Tags

Tags in a non-interactive disabled state

Disabled
Disabled Closable
Disabled Icon
<div className="flex flex-wrap gap-2">
<Tag disabled>Disabled</Tag>
<Tag disabled closable>Disabled Closable</Tag>
<Tag disabled startElement={<MdStar className="size-5" />}>Disabled Icon</Tag>
</div>

Best Practices

Keep labels short

Tag text should be 1-3 words. Long text defeats the compact purpose.

Use closable for filters

When tags represent applied filters or selections, make them closable so users can remove them.

Don't use as buttons

Tags display information. For clickable actions, use Button or Link.

Don't overload a view with tags

Limit visible tags per item to 3-5. Show a "+N more" overflow for additional tags.

Props

PropTypeDefaultDescription
size'sm' | 'md' | 'lg''lg'Tag size
startElementReactNode-Icon, avatar, or element before the text
endElementReactNode-Icon or element after the text (hidden when closable)
closablebooleanfalseShow a close/remove button
onClose() => void-Callback when close button is clicked
disabledbooleanfalseDisable the tag and close button
childrenReactNode-Tag text content
classNamestring-Additional className

Accessibility

  • Close button has aria-label="Remove" for screen readers.
  • Close button is keyboard accessible with Enter/Space.
  • Disabled state prevents interaction on the close button.
  • Use descriptive text that makes sense without visual context.