Skip to content
Focsd homeFocsd homeFocsd
Forms

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.

  • Tag: focsd-tag
  • Pattern: Static + optional remove button
  • Category: Display

Example

Waiting Shipped Delivered Canceled
Research Design Starred
HTML
<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.

Design Research Brand Ops Growth Data
HTML
<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.

Small Medium Large
HTML
<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>

API

Attributes

AttributePropertyTypeDefault
tonetone'neutral' | 'info' | 'positive' | 'caution' | 'critical'neutral
removableremovablebooleanfalse
remove-labelremoveLabelstring—
iconiconstring—
icon-libraryiconLibrarystring—
sizesize's' | 'm' | 'l'm
shapeshape'rounded' | 'pill'rounded
colorcolorstring—

Slots

SlotDescription
(default)The label.
iconA 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).

PartDescription
iconThe icon before the label.
removeThe remove button (with `removable`).
tagThe 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, caution and critical.
  • When removable, a real button named "Remove Design" fires focsd-remove; the tag does not remove itself, so your app stays in control (and can move focus sensibly).

Keyboard

KeyAction
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).