Skip to content
Alea0.1

Data display

Tag

Removable or selectable tags: filters and chosen values.

Ant Design: Tag, Select mode="tags"

import { TagGroup, Tag } from '@alea/ui';

Examples

Removable tags

Chosen values with an x. Delete and Backspace remove the focused tag.

Languages to test
German
Japanese
Arabic
Finnish

Filters

selectionMode turns tags into toggles.

Show
Tools
Games
Guides
Plugins

Props

TagGroup props

Tags that can be selected (filters) or removed (chosen values). Arrow keys move, Delete removes.

PropTypeDefaultDescription
itemsIterable<T>-The tags as data, rendered with the children function.
labelReactNode-The visible label for the group.
onRemove((keys: Set<Key>) => void)-Called with the removed keys; shows an x on each tag.
renderEmptyState(() => ReactNode)-Shown when there are no tags.

Tag props

One tag in a TagGroup.

PropTypeDefaultDescription
tone"danger" | "success" | "warning" | "accent" | "info" | "neutral"'neutral'Color of the tag: neutral (default), accent, success, warning, danger or info.

Accessibility

  • A keyboard-navigable grid; Delete and Backspace remove the focused tag.

Keyboard

KeyDoes
Arrow keysMove between tags
Delete / BackspaceRemoves the tag
SpaceSelects (selection mode)

Do and don't

Do

  • Keep tags to one or two words.
  • Make removable tags removable with the keyboard too (onRemove does it).

Don't

  • Don't use tags as buttons that run actions.
  • Don't show more than a line of tags without a way to see the rest.
Tested with axe, keyboard and screen reader roles