Pill
Compact, rounded tag with color variants, sizes, an optional leading icon, and an optional remove control.
Preview
Wetlands
<Pill label="Wetlands" variant="success" removable={false} /> Variants
Default Primary Success Warning Danger Info
<Pill label="Default" variant="default" removable={false} />
<Pill label="Primary" variant="primary" removable={false} />
<Pill label="Success" variant="success" removable={false} />
<Pill label="Warning" variant="warning" removable={false} />
<Pill label="Danger" variant="danger" removable={false} />
<Pill label="Info" variant="info" removable={false} /> Sizes
Extra small Small Medium Large
<Pill label="Extra small" size="xs" removable={false} />
<Pill label="Small" size="sm" removable={false} />
<Pill label="Medium" size="md" removable={false} />
<Pill label="Large" size="lg" removable={false} /> Icon & removable
Pass a leading icon via the icon slot. With removable (the default), a × button emits a removed event and removes the pill from the DOM.
Tagged Wetlands Overdue
<Pill label="Tagged" variant="primary" removable={false}>
<svg slot="icon">…</svg>
</Pill>
<Pill label="Wetlands" variant="success" />
<Pill label="Overdue" variant="danger" /> API
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | Required. Text shown inside the pill. |
variant | 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'default' | Color intent — drives background, text, and border. |
size | 'xs' | 'sm' | 'md' | 'lg' | 'md' | Pill height and text size. |
removable | boolean | true | Shows a remove (×) button. |
Slots
| Prop | Type | Default | Description |
|---|---|---|---|
icon | slot | — | Leading inline SVG, rendered left of the label. |
Events
| Prop | Type | Default | Description |
|---|---|---|---|
removed | CustomEvent | — | Bubbles when the remove button is clicked; the pill then removes itself from the DOM. |
Accessibility
- The remove button has
aria-label="Remove"; the leading icon isaria-hidden. - Remove click
stopPropagation()s so it won't trigger a click on a surrounding interactive container. - Color intent is reinforced by the label text — color is never the only signal.
Theming surface
Every public token this component reads, extracted from its source at build time.
The Resolves to column walks each token's real lineage —
component → semantic → primitive → raw value — so you
can see exactly where re-pointing it lands. A spoke re-skins by overriding these in
its theme-<slug>.css; component internals are never edited. No
hook for what you need? File it with /request-lego.
| Token | Tier | Resolves to |
|---|---|---|
--focus-ring-color | component | #65ba74 via --color-border-focus → --color-grass-8 |
--focus-ring-width | component | 2px |
--pill-bg | component | #f0f0f0 via --color-surface-sunken → --color-gray-3 |
--pill-border-color | component | #d9d9d9 via --color-border-light → --color-gray-6 |
--pill-height-lg | component | 34px |
--pill-height-md | component | 28px |
--pill-height-sm | component | 22px |
--pill-height-xs | component | 18px |
--pill-radius | component | 0.25rem via --radius-100 |
--pill-remove-bg-hover | component | rgba(0, 0, 0, 0.1) |
--pill-text-color | component | #202020 via --color-text-primary → --color-gray-12 |
--color-danger-border | semantic | #fdbdbe via --color-red-6 |
--color-danger-strong | semantic | #ce2c31 via --color-red-11 |
--color-danger-subtle | semantic | #fff7f7 via --color-red-2 |
--color-info-border | semantic | #acd8fc via --color-status-info-border → --color-blue-6 |
--color-info-strong | semantic | #0d74ce via --color-status-info-strong → --color-blue-11 |
--color-info-subtle | semantic | #f4faff via --color-status-info-subtle → --color-blue-2 |
--color-primary-border | semantic | #b2ddb5 via --color-grass-6 |
--color-primary-strong | semantic | #2a7e3b via --color-grass-11 |
--color-primary-subtle | semantic | #f5fbf5 via --color-grass-2 |
--color-success-border | semantic | #c2da91 via --color-status-success-border → --color-lime-6 |
--color-success-strong | semantic | #5c7c2f via --color-status-success-strong → --color-lime-11 |
--color-success-subtle | semantic | #f8faf3 via --color-status-success-subtle → --color-lime-2 |
--color-warning-border | semantic | #f3d673 via --color-status-warning-border → --color-yellow-6 |
--color-warning-strong | semantic | #ab6400 via --color-status-warning-strong → --color-yellow-11 |
--color-warning-subtle | semantic | #fefbe9 via --color-status-warning-subtle → --color-yellow-2 |
--focus-ring-offset | semantic | 2px |
--transition-fast | semantic | 150ms ease |
--radius-full | primitive | 9999px |
--spacing-100 | primitive | 0.25rem |
--spacing-150 | primitive | 0.375rem |
--spacing-200 | primitive | 0.5rem |
--spacing-300 | primitive | 0.75rem |