Components Data display
Tag
StableA compact keyword label for categories and filters, with an optional accessible remove button.
Use Tag to show assigned groups, departments or labels, and let people remove them. Every remove button has its own label, such as "Remove Marketing", so screen-reader users know which tag it affects.
Overview
SalesLondon officeQ4 campaign
import { Tag } from '@bindshq/stance-react';
export function Basic() {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
<Tag>Sales</Tag>
<Tag>London office</Tag>
<Tag>Q4 campaign</Tag>
</div>
);
}Light, dark and high contrast
Every Stance component is designed and tested in all three appearance modes.
SalesLondon officeQ4 campaign
SalesLondon officeQ4 campaign
SalesLondon officeQ4 campaign
Import
import { Tag } from '@bindshq/stance-react';Platforms
Tag has native counterparts. They share Stance tokens and intent, and use each platform’s own controls and conventions. The live previews on this page are the web implementation.
import { Tag } from '@bindshq/stance-react';Examples
MarketingLegalEMEAContractors
import * as React from 'react';
import { Tag } from '@bindshq/stance-react';
export function Removable() {
const [tags, setTags] = React.useState(['Marketing', 'Legal', 'EMEA', 'Contractors']);
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
{tags.map((t) => (
<Tag key={t} onRemove={() => setTags((all) => all.filter((x) => x !== t))}>
{t}
</Tag>
))}
{tags.length === 0 && <span>All departments removed.</span>}
</div>
);
}GroupNorthwind LtdGlobal
import { Icon, Tag } from '@bindshq/stance-react';
export function WithIcons() {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 8 }}>
<Tag size="sm" icon={<Icon name="users" size={12} />}>
Group
</Tag>
<Tag icon={<Icon name="building" />}>Northwind Ltd</Tag>
<Tag icon={<Icon name="globe" />} onRemove={() => {}} disabled>
Global
</Tag>
</div>
);
}API reference
| Prop | Type | Default | Description |
|---|---|---|---|
size | 'sm' | 'md' | 'md' | Height 22 or 28px. |
icon | ReactNode | None | Leading icon. |
onRemove | () => void | None | Shows a remove button when provided. |
removeLabel | string | None | Remove button label; defaults to "Remove <text>". |
disabled | boolean | false | Disables removal. |
Accessibility
- The remove control is a real button named after the tag, e.g. "Remove Marketing".
- When children are not plain text, pass removeLabel.
- After removing a tag, move focus to a sensible place, such as the next tag or the input that adds tags.
Keyboard
| Keys | Action |
|---|---|
| Enter Space | Removes the tag when its remove button is focused. |
Usage guidelines
Do
- Keep tag text short.
Don’t
- Use Tag for status; use Badge.