Skip to main content
PROYECTOVIVIANA

TagGroup

TagGroup displays a collection of tags that can be removable or selectable. Use tags to categorize content, filter results, or represent user selections.

Import

import { TagGroup } from '@proyecto-viviana/solid-spectrum';

Removable Tags

Tags with a remove button. Click the remove icon on any tag to remove it from the list.

Frameworks
React
SolidJS
Vue
Svelte
Angular

5 tags remaining

const [tags, setTags] = createSignal(initialTags);

<TagGroup
  label="Frameworks"
  items={tags()}
  onRemove={(keys) => {
    setTags(prev => prev.filter(t => !keys.has(t.id)));
  }}
>
  {(item) => item.name}
</TagGroup>

Selectable Tags

Tags that can be selected to filter or categorize content. Single selection mode allows picking one category.

Category
Frontend
Backend
DevOps
Design
Mobile
Data Science

Selected: frontend

<TagGroup
  label="Category"
  items={categories}
  selectionMode="single"
  selectedKeys={selectedKeys()}
  onSelectionChange={setSelectedKeys}
>
  {(item) => item.name}
</TagGroup>

Multi-Select Tags

Multiple tags can be selected simultaneously for filtering by multiple criteria.

Status Filter
Active
Pending
Archived
Draft

Filtering by: active, pending

<TagGroup
  label="Status Filter"
  items={statuses}
  selectionMode="multiple"
  selectedKeys={multiSelected()}
  onSelectionChange={setMultiSelected}
>
  {(item) => item.name}
</TagGroup>

Variants

Tags support different visual styles.

Default
Active
Pending
Archived
Outline
Active
Pending
Archived
Solid
Active
Pending
Archived
<TagGroup label="Default" items={tags} variant="default">{(item) => item.name}</TagGroup>
<TagGroup label="Outline" items={tags} variant="outline">{(item) => item.name}</TagGroup>
<TagGroup label="Solid" items={tags} variant="solid">{(item) => item.name}</TagGroup>

Sizes

Tags are available in different sizes.

Small
Frontend
Backend
DevOps
Design
Medium (default)
Frontend
Backend
DevOps
Design
Large
Frontend
Backend
DevOps
Design
<TagGroup label="Small" items={tags} size="sm">{(item) => item.name}</TagGroup>
<TagGroup label="Medium" items={tags} size="md">{(item) => item.name}</TagGroup>
<TagGroup label="Large" items={tags} size="lg">{(item) => item.name}</TagGroup>

Props

PropTypeDefaultDescription
itemsT[]Collection of tag items to display
labelstringVisible label for the tag group
onRemove(keys: Set<Key>) => voidHandler called when tags are removed. Enables remove buttons on tags.
selectionMode'none' | 'single' | 'multiple''none'How tags can be selected
selectedKeysSet<Key> | 'all'Currently selected tag keys (controlled)
defaultSelectedKeysIterable<Key>Default selected tag keys (uncontrolled)
onSelectionChange(keys: Set<Key> | 'all') => voidHandler called when selection changes
variant'default' | 'outline' | 'solid''default'Visual style of the tags
size'sm' | 'md' | 'lg''md'Size of the tags
isDisabledbooleanfalseWhether all tags are disabled
disabledKeysIterable<Key>Keys of disabled tags

Accessibility

  • Uses role="listbox" with role="option" for each tag
  • Arrow keys navigate between tags
  • Delete or Backspace removes focused tag when removable
  • Space or Enter toggles selection on focused tag
  • Remove buttons have accessible labels like "Remove [tag name]"
  • Group label is linked via aria-labelledby
  • Selection state is announced to screen readers
  • Focus moves to the next tag after removal