Build faster with Premium Chakra UI Components 💎

Learn more
Skip to Content
DocsPlaygroundGuidesBlog
Sponsor

Tag

Used for categorizing or labeling content

SourceStorybookRecipe
Plain Tag
Closable Tag

Setup

If you don't already have the snippet, run the following command to add the tag snippet

chakra snippet add tag

The snippet includes a closed component composition for the Tag component.

Usage

import { Tag } from "@/components/ui/tag"
<Tag>Tag here</Tag>

Examples

Icon

Use the startElement prop to add an icon to the tag.

Tag 2
Top Rated

Variants

Use the variant prop to change the appearance of the tag.

Gray
Gray
Gray
Gray
Gray
Gray
Gray
Gray
Gray
Gray
Gray
Gray

Sizes

Use the size prop to change the size of the tag.

Gray
Gray
Gray
Gray
Gray
Gray
Gray
Gray
Gray

Colors

Use the colorPalette prop to change the color of the tag.

gray

Content
Content
Content

red

Content
Content
Content

green

Content
Content
Content

blue

Content
Content
Content

teal

Content
Content
Content

pink

Content
Content
Content

purple

Content
Content
Content

cyan

Content
Content
Content

orange

Content
Content
Content

yellow

Content
Content
Content

Closable

Use the closable prop to make the tag closable.

Tag 1
Tag 2

Overflow

Use the maxWidth prop to control the maximum width of the tag. When the content exceeds this width, it will be truncated with an ellipsis.

This is particularly useful when dealing with dynamic or user-generated content where the length might vary.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam molestias, laboriosam, quod, quia quidem quae voluptatem natus exercitationem autem quibusdam

Avatar

The tag component has been designed to work well with the Avatar component.

Note: Set the avatar size to full to ensure it's sized correctly.

JD
Emily (sm)
JD
Emily (md)
JD
Emily (lg)
JD
Emily (xl)

Render as button

Use the asChild prop to render the tag as a button.

Note: Import the Tag from @chakra-ui/react to use this prop.

Props

Root

PropDefaultType
colorPalette 'gray'
'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink' | 'accent'

The color palette of the component

size 'md'
'sm' | 'md' | 'lg'

The size of the component

variant 'surface'
'subtle' | 'solid' | 'outline' | 'surface'

The variant of the component

Previous

Table

Next

Textarea