Tag
Tag is a compact label used to categorize, classify, or annotate content with color-coded visual styles.
import { Tag } from '@/components/ui/wideset/tag/Tag';
<Tag>Design</Tag>
<Tag>Research</Tag>
<Tag>Q4 launch</Tag>Installation
pnpm dlx wideset add tag
Copies the component and any Wideset components it uses into your project.
Examples
Colors
Tag colours are categorical, not semantic: they tell categories apart (a project, a team, a topic) and say nothing about success or danger, which is Status badge's job. Give each category one colour and keep it everywhere; secondary is the neutral fallback.
import { Tag } from '@/components/ui/wideset/tag/Tag';
const tags = [
['brand', 'Wideset'],
['red', 'Marketing'],
['pink', 'Brand'],
['violet', 'Research'],
['purple', 'Design'],
['indigo', 'Platform'],
['blue', 'Engineering'],
['cyan', 'Data'],
['teal', 'Support'],
['green', 'Finance'],
['lime', 'Growth'],
['yellow', 'Legal'],
['orange', 'Sales'],
['secondary', 'Other'],
] as const;
export default function TagColors() {
return (
<div className="gap-ws-8 flex flex-wrap items-center">
{tags.map(([color, label]) => (
<Tag key={color} color={color}>
{label}
</Tag>
))}
</div>
);
}Presets
Filled has a solid tint and stands out in lists and cards. Border keeps only the outline, for long rows of tags or busy layouts where filled tags would compete with the content. Use one preset per list.
import { Tag } from '@/components/ui/wideset/tag/Tag';
export default function TagPresets() {
return (
<div className="gap-ws-8 flex flex-wrap items-center">
<Tag preset="filled">Design</Tag>
<Tag preset="border">Design</Tag>
</div>
);
}Sizes
Medium is the default. Small fits table cells and dense lists; large sits next to larger text, such as a card title. Tags in one row share a size.
import { Tag } from '@/components/ui/wideset/tag/Tag';
export default function TagSizes() {
return (
<div className="gap-ws-8 flex flex-wrap items-center">
{(['sm', 'md', 'lg'] as const).map((size) => (
<Tag key={size} size={size}>
Design
</Tag>
))}
</div>
);
}Shapes
Square is the default and lines up with other rectangular elements such as inputs and table cells. Rounded is a pill, a softer look for tags on cards and profiles. Pick one shape per product.
import { Tag } from '@/components/ui/wideset/tag/Tag';
export default function TagShapes() {
return (
<div className="gap-ws-8 flex flex-wrap items-center">
<Tag shape="square">Design</Tag>
<Tag shape="rounded">Design</Tag>
</div>
);
}Icons
A leading icon helps the eye find a category in a long list. The icon is hidden from screen readers, so an iconOnly tag needs its name in text: put it in a visually hidden span, or the tag says nothing at all.
import { RiFlashlightFill } from '@remixicon/react';
import { Tag } from '@/components/ui/wideset/tag/Tag';
export default function TagIcons() {
return (
<div className="gap-ws-8 flex flex-wrap items-center">
<Tag>
<Tag.Icon icon={RiFlashlightFill} />
Quick win
</Tag>
<Tag iconOnly>
<Tag.Icon icon={RiFlashlightFill} />
<span className="sr-only">Quick win</span>
</Tag>
</div>
);
}API reference
Tag
| Name | Description | Default |
|---|---|---|
color | 'blue''purple''pink''orange''lime''teal''brand''violet''red''yellow''green''cyan''indigo''secondary' | 'brand' |
iconOnly | When true, renders the tag as an icon-only variant with equal padding on all sides. boolean | false |
preset | 'border''filled' | 'filled' |
shape | 'rounded''square' | 'square' |
size | 'sm''md''lg' | 'md' |
truncate | When true, truncates overflowing text with an ellipsis. boolean | false |
<div> is passed through to it. See MDN: <div>.Tag.Icon
| Name | Description | Default |
|---|---|---|
icon* | Icon component from `@remixicon/react`. RemixiconComponentType | — |
<div> is passed through to it. See MDN: <div>.Accessibility
- Tag is a
divwith plain text; it is not focusable and has no role. Tag.Iconis hidden from screen readers. AniconOnlytag needs its name in asr-onlyspan.- Colour alone never carries meaning; the label does.
| Part | Renders | Description |
|---|---|---|
| TagRenders no element | <div> | A compact descriptive label with optional icon. |
| Tag.IconRenders no element | <div> | An icon rendered within `Tag`. |
import { Tag } from '@/components/ui/wideset/tag/Tag';
<Tag>Design</Tag>
<Tag>Research</Tag>
<Tag>Q4 launch</Tag>