Weftv0.4.0
GitHubFigma
Blade AI
Display & Navigation · Tagstable

Tag

A compact label for a filter, category or attribute, with an optional remove button and a TagGroup that wraps a row of them.

Preview

#preview

Switch size, remove button, state and grouping. Show code opens the React and CSS below.

Status: Settled
medium · yes · default · single
tag-example.tsx
import { Tag } from "@blade-ai/weft/components/tag";

export function SettledFilter({ onRemove }: Props) {
  return (
    <Tag
      onRemove={onRemove}
    >
      Status: Settled
    </Tag>
  );
}

All states

#all-states

Both sizes with and without remove, the forced remove states, and TagGroup.

Tag · 12 states · size medium unless noted
Status: Settled
Default
Status: Settled
Removable
Status: Settled
Large
Status: Settled
Remove · hover
Status: Settled
Remove · focus
Status: Settled
Disabled
Status: Settled
Large · hover
Status: Settled
Large · focus
Status: Settled
Large · disabled
FiltersSettledCard
Tag group
FiltersSettledCardEU
Tag group · no clear
FiltersSettledCard
Tag group · large

Props

#props

Tag and TagGroup. Native span attributes pass through to Tag.

Tag
Prop
Type
Default
Description
children
ReactNode
—
Visible text, for example "Status: Settled". Required.
size
"medium" | "large"
"medium"
Height 24 or 28px.
onRemove
() => void
—
Shows the remove button. The app removes the tag; this only reports the click.
removeLabel
string
—
Accessible name of the remove button. Defaults to "Remove <text>" for string children.
isDisabled
boolean
false
Dimmed to 60%; the remove button is disabled.
data-state
"hover" | "focus"
—
Forces the remove button state.
TagGroup
Prop
Type
Default
Description
label
string
—
Leading text and accessible name of the group, for example "Filters".
onClearAll
() => void
—
When set, a Clear all link button ends the group.
clearAllLabel
string
"Clear all"
Text of the clear button.
children
ReactNode
—
The Tags. Required.

Usage

#usage

Short rules for choosing and writing tags.

Do
Keep text short: a field and its value ("Status: Settled").
Show remove only when the tag is a filter or a choice people can undo.
Use a TagGroup with Clear all once there are three or more tags.
Name the remove button when the text alone is ambiguous.
Don't
Do not use a tag as a button or a link.
Do not use tags for status; use Badge.
Do not truncate the text; let the group wrap.
Do not rely on colour alone to tell tags apart.

Accessibility

#accessibility

The remove button is a real button with its own name. Backspace and Delete also remove.

Keyboard
Key
Action
Tab
Moves focus to the remove button.
Enter / Space
Removes the tag.
Backspace / Delete
Removes the tag from the focused remove button.
ARIA
Element
Role / attribute
When
Remove button
aria-label
Always. Defaults to "Remove <text>" for string children.
Remove button
disabled
When the tag is disabled.
TagGroup
role="group" · aria-label
Always. Label comes from the label prop.
Tag
—
Plain text span; it is not focusable.