Tag / chip
A short label for a status, a category or a filter, with an optional icon before it and an optional remove button after it.
Example
<div class="stack"> <div class="row"> <focsd-tag tone="caution" shape="pill"> <svg slot="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <circle cx="12" cy="12" r="10" /> <path d="M12 6v6l4 2" /> </svg> Waiting </focsd-tag> <focsd-tag tone="info" shape="pill"> <svg slot="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2" /> <path d="M15 18H9" /> <path d="M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14" /> <circle cx="17" cy="18" r="2" /> <circle cx="7" cy="18" r="2" /> </svg> Shipped </focsd-tag> <focsd-tag tone="positive" shape="pill"> <svg slot="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <circle cx="12" cy="12" r="10" /> <path d="m9 12 2 2 4-4" /> </svg> Delivered </focsd-tag> <focsd-tag shape="pill"> <svg slot="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2" /> <path d="M15 18H9" /> <path d="M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14" /> <circle cx="17" cy="18" r="2" /> <circle cx="7" cy="18" r="2" /> </svg> Canceled </focsd-tag> </div> <div class="row"> <focsd-tag>Research</focsd-tag> <focsd-tag removable>Design</focsd-tag> <focsd-tag icon="star" removable>Starred</focsd-tag> </div></div>Category colors
color names a category hue (blue, violet, pink, red, orange, amber, green, teal). The colorful Prismatic preset shows it; other presets keep the plain or toned look, so the label still says what the tag means.
<div class="row" data-focsd-brand="prismatic"> <focsd-tag shape="pill" color="blue">Design</focsd-tag> <focsd-tag shape="pill" color="violet">Research</focsd-tag> <focsd-tag shape="pill" color="pink">Brand</focsd-tag> <focsd-tag shape="pill" color="orange">Ops</focsd-tag> <focsd-tag shape="pill" color="green">Growth</focsd-tag> <focsd-tag shape="pill" color="teal">Data</focsd-tag></div>Sizes and shapes
size takes s, m (default) or l; shape="pill" gives fully round ends. Use icon for a built-in icon or slot="icon" for your own.
<div class="row"> <focsd-tag size="s" shape="pill" tone="info" removable> <svg slot="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2" /> <path d="M15 18H9" /> <path d="M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14" /> <circle cx="17" cy="18" r="2" /> <circle cx="7" cy="18" r="2" /> </svg> Small </focsd-tag> <focsd-tag shape="pill" tone="info" removable> <svg slot="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2" /> <path d="M15 18H9" /> <path d="M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14" /> <circle cx="17" cy="18" r="2" /> <circle cx="7" cy="18" r="2" /> </svg> Medium </focsd-tag> <focsd-tag size="l" shape="pill" tone="info" removable> <svg slot="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2" /> <path d="M15 18H9" /> <path d="M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14" /> <circle cx="17" cy="18" r="2" /> <circle cx="7" cy="18" r="2" /> </svg> Large </focsd-tag></div>Usage
Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.
<script type="module"> import '@focsd-dev/components/focsd-tag.js';</script>
<focsd-tag tone="caution" shape="pill">…</focsd-tag>import { Tag } from '@focsd-dev/react';
export function Example() { return <Tag tone="caution" shape="pill">…</Tag>;}<script setup>import '@focsd-dev/components/focsd-tag.js';</script>
<template> <focsd-tag tone="caution" shape="pill">…</focsd-tag></template>// Add CUSTOM_ELEMENTS_SCHEMA to the component's schemas, then:import '@focsd-dev/components/focsd-tag.js';
// template<focsd-tag tone="caution" shape="pill">…</focsd-tag><script> import '@focsd-dev/components/focsd-tag.js';</script>
<focsd-tag tone="caution" shape="pill">…</focsd-tag>API
Attributes
| Attribute | Property | Type | Default |
|---|---|---|---|
tone | tone | 'neutral' | 'info' | 'positive' | 'caution' | 'critical' | neutral |
removable | removable | boolean | false |
remove-label | removeLabel | string | — |
icon | icon | string | — |
icon-library | iconLibrary | string | — |
size | size | 's' | 'm' | 'l' | m |
shape | shape | 'rounded' | 'pill' | rounded |
color | color | string | — |
Slots
| Slot | Description |
|---|---|
(default) | The label. |
icon | A custom icon (an svg or focsd-icon) before the label, used instead of the icon attribute. |
CSS parts
Style the inside of the component with ::part(), for example focsd-tag::part(icon).
| Part | Description |
|---|---|
icon | The icon before the label. |
remove | The remove button (with `removable`). |
tag | The tag element. |
Accessibility
- The label names the tag; the icon is decoration and hidden from assistive technology, so a status always reads in words, never by color or icon alone.
- A toned tag is filled with its tone and edged in it. Tones are
neutral(default),info,positive,cautionandcritical. - When
removable, a real button named "Remove Design" firesfocsd-remove; the tag does not remove itself, so your app stays in control (and can move focus sensibly).
Keyboard
| Key | Action |
|---|---|
| Enter / Space (remove button) | Fire focsd-remove |
Category colors
- The color only groups tags visually; the label carries the meaning, so nothing is lost without color (WCAG 1.4.1).
Sizes and shapes
- The remove button stays at least 24 px at every size (WCAG 2.5.8 target size).
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.