Tag
A label that classifies a thing: a topic, a kind, a word the person chose. It never says a state; that is a Badge or a Status.
import { Tag, TagSkeleton } from '@sypnia/ui/react'
On this page
Labels of a table
billingenv:prodteam:growthread-only
Code
import { useState } from 'react';
import { Tag, TagSkeleton } from '@sypnia/ui/react';
// Words that classify. Remove one with its ×. The last one is the skeleton.
export default function Labels() {
const [tags, setTags] = useState(['billing', 'env:prod', 'team:growth']);
return (
<div className="sy-row">
{tags.map((t) => <Tag key={t} machine={t.includes(':')} onRemove={() => setTags(tags.filter((x) => x !== t))}>{t}</Tag>)}
<Tag>read-only</Tag>
<TagSkeleton />
</div>
);
} When to use it
Use it when
- Labels people add to projects, tables or files.
machinefor labels written as code:env:prod.
Do not use it when
- States such as «Active» or «Failed»: use Badge or Status.
- Filters that are on: use FilterChip.
For everyone
- The × is a button named «Remove billing».
Props
| Tag | Type | Default |
|---|---|---|
machine | boolean | |
onRemove | (() => void) | |
removeLabel | string |