Tag

Tag component is used for items that need to be labeled, categorized, or organized using keywords that describe them.

SourceTheme Source@chakra-ui/tag

Import#

import { Tag } from '@chakra-ui/react'

Usage#

<Tag.Root>
<Tag.Label>Sample Tag</Tag.Label>
</Tag.Root>

Sizes#

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

<HStack gap={4}>
{['sm', 'md', 'lg'].map((size) => (
<Tag.Root size={size} key={size} variant='solid' colorPalette='teal'>
<Tag.Label>Teal</Tag.Label>
</Tag.Root>
))}
</HStack>

Rendering an icon#

<HStack gap={4}>
{['sm', 'md', 'lg'].map((size) => (
<Tag.Root size={size} key={size} variant='subtle' colorPalette='cyan'>
<FiPlus />
<Tag.Label>Cyan</Tag.Label>
</Tag.Root>
))}
</HStack>

Rendering the close button#

<HStack gap={4}>
{['sm', 'md', 'lg'].map((size) => (
<Tag.Root size={size} key={size} colorPalette='green'>
<Tag.Label>Green</Tag.Label>
<Tag.CloseTrigger />
</Tag.Root>
))}
</HStack>

Usage with avatar#

<Tag.Root variant='outline' borderRadius='full'>
<Avatar.Root size='xs'>
<Avatar.Image src='https://bit.ly/dan-abramov' />
<Avatar.Fallback name='Dan Abrahmov' />
</Avatar.Root>
<Tag.Label> Dan Abramov</Tag.Label>
<Tag.CloseTrigger />
</Tag.Root>
Edit this page on GitHub

Proudly made inNigeria by Segun Adebayo

Deployed by â–² Vercel