UI

Pill

A compact static label for statuses, categories, method tags, and counts with animated swaps and spring width morphing.

import { Pill } from '@uthereal/ui/pill'

Pill playground

Ready
Loading interactive preview…

Overview

Pill renders a compact inline label for a status (Active), category (Design), HTTP method (GET), or count (12 new). Keep the same instance mounted and update label, children, icon, or tone to animate the transition in place: the new text rises through a soft blur while the container springs to its new width.

Pill is static text, not an interactive control. Use Button for actions or toggles, TagInput for editable tag lists, and ShortcutInput for recording keyboard shortcuts.

Usage

'use client'
import { Pill } from '@uthereal/ui/pill'

type DeployState = 'queued' | 'deploying' | 'live' | 'failed'

const states: Record<
  DeployState,
  {
    label: string
    tone: 'neutral' | 'info' | 'success' | 'danger'
    icon: 'clock' | 'sparkles' | 'check' | 'triangle-alert'
  }
> = {
  queued: { label: 'Queued', tone: 'neutral', icon: 'clock' },
  deploying: { label: 'Deploying', tone: 'info', icon: 'sparkles' },
  live: { label: 'Live', tone: 'success', icon: 'check' },
  failed: { label: 'Failed', tone: 'danger', icon: 'triangle-alert' },
}

export function DeployStatus({ state }: { state: DeployState }) {
  const current = states[state]
  return <Pill label={current.label} tone={current.tone} icon={current.icon} />
}

In React, string or number children replace label and participate in the same text swap and width morph. Richer JSX children render directly inside the pill.

Examples

Use <SchemaPlayground /> above to inspect individual props, recipe, theme, and motion presets. The sets below show semantic tones, categorical colors, and structural decorations.

Semantic tones

tone selects a semantic status role. Pair status tones (success, info, warning, danger) with words that state the same status so meaning never relies on color alone.

Draft
Active
In review
Near limit
Failed

Categorical colors

color selects from the shared six-hue categorical palette (teal, sky, orchid, violet, rose, amber) and overrides tone. Use categorical colors for non-status taxonomies such as HTTP methods or labels.

GET
POST
PUT
PATCH
DELETE
HEAD

Sizes, marks, outline, and corners

size scales the pill on a 4 px grid (sm, md, lg). Add dot for live statuses or icon for a leading glyph (when both are set, icon takes precedence and dot is ignored). Set outline to draw a hairline border on busy surfaces, and set rounded="default" to use soft corners instead of full pill ends.

Small
Deploying
Beta

Tones, colors, and sizes

All tints mix in oklab against --ui-surface, --ui-text, and --ui-border so every hue adapts across light mode, dark mode, and both studio and soft recipes.

PropValueRoleBase tokenNotes
toneneutralCategories, counts, metadata--ui-text-secondaryDefault role; does not follow accent
tonesuccessCompleted, healthy, active state--ui-successPair with explicit status wording
toneinfoInformational or in-progress note--ui-infoSemantic info hue
tonewarningCaution, pending review, limits--ui-warningLight mode deepens text mix to 76% for AA ink
tonedangerFailure, error, destructive flag--ui-dangerDoubles outline under forced-colors: active
colortealCategorical tag (e.g. GET)--ui-pill-tealLight #007467 / Dark #37d5c1; overrides tone
colorskyCategorical tag (e.g. POST)--ui-pill-skyLight #136d9e / Dark #7cc4f0; overrides tone
colororchidCategorical tag (e.g. PUT)--ui-pill-orchidLight #943fa2 / Dark #dd8fe9; overrides tone
colorvioletCategorical tag (e.g. PATCH)--ui-pill-violetLight #6850b9 / Dark #aa9df4; overrides tone
colorroseCategorical tag (e.g. DELETE)--ui-pill-roseLight #bb2c54 / Dark #f0738f; overrides tone
coloramberCategorical tag (e.g. HEAD)--ui-pill-amberLight #9f6202 (76% ink) / Dark #f2bd68
sizeHeightDefault radius (rounded="default")Inline paddingMark-to-label gapText sizeIcon sizeDot size
sm20 px5 px8 px4 px11 px12 px5 px
md24 px6 px10 px5 px12 px14 px6 px
lg28 px7 px12 px6 px14 px16 px7 px

When a leading mark is present, padding-inline-start tightens by 2 px for icon and 1 px for dot so visual balance matches the trailing edge in both LTR and RTL layouts.

API reference

Serializable schema arguments and defaults come directly from pillConfigSchema.

ArgumentType / defaultDescription
labelstringDefault: "Pill"Visible text, kept short: a status ("Active"), a category ("Design") or a count ("12 new"). Keep the pill mounted and change the label for the morph; remounting with a new key loses it.
toneneutral | success | info | warning | dangerDefault: "neutral"Color role. neutral is secondary text; success, warning, danger and info report a state — use them only when the label states that status, and pair the words with the color.
colorteal | sky | orchid | violet | rose | amber—Categorical color from the shared tone family (Arc's --tone-* palette), for labels such as method tags: GET teal, POST sky, PUT orchid, PATCH violet, DELETE rose. Overrides tone; never use a categorical color to mean success or failure.
sizesm | md | lgDefault: "md"Height: 20, 24 or 28 pixels with 11, 12 or 14 pixel text, as in Arc.
iconIconName—Decorative icon before the label, from the Icons page, in the tone color. Takes precedence over dot.
dotbooleanDefault: falseA small dot in the tone color before the label, for live statuses. Ignored when an icon is set.
outlinebooleanDefault: falseDraw a hairline border in the tone color.
roundeddefault | fullDefault: "full"default keeps the size's soft corners (5, 6 or 7 px); full is the original pill-shaped ends.
recipestudio | softDefault: "studio"Visual treatment. Both recipes behave the same way.
themePillTheme—Color mode, and tokens for colors, type, the height, radius, padding, gap, text, icon and dot sizes, and the categorical tone colors. See Theming.
motionnone | subtle | expressiveDefault: "subtle"Label and icon swaps (the new text rises through a small blur while the pill springs to its new width) and tone color transitions. System reduced-motion preferences fade instead and snap the width.
motionOptionsPillMotionOptions—Label swap duration and the width transition.
dirltr | rtl—Reading direction. Omit it to inherit the page direction.

React integration

PropPurpose
childrenString or number replaces label with full swap/morph motion; richer React nodes render directly.
renderIcon(name, context)Replaces the decorative leading icon (context provides { size, slot: 'icon' }); wrapped in IconSlot.
presetApplication defaults overridden by explicit instance props (label and icon are excluded).
tokens--ui-* CSS variables applied after the typed theme.
refRef to the root <span> element.
className, styleForwarded to the root <span>; style wins over motion and theme tokens.
Native <span> attributesid, title, role, aria-*, data-*, and event handlers forwarded to the root <span>.

Accessibility

Pill renders a non-focusable <span> with no interactive keyboard stops. During animated label or icon swaps, outgoing exiting copies receive aria-hidden="true" so screen readers announce only the active text. Leading dot and icon marks are decorative (aria-hidden="true").

All layout rules use CSS logical properties (min-inline-size, padding-inline-start, inline-size, block-size) and honor dir="rtl" (or inherited page direction when dir is omitted). Under forced-colors: active, every pill draws a CanvasText border, tone="danger" adds a 2 px inset CanvasText outline, and the status dot uses CanvasText with forced-color-adjust: none.

Motion and theming

Pill animates content changes in place while keeping passive layout reflows (such as webfont loading or container visibility toggles) instant: ResizeObserver springs the inline width only within a 120 ms window after label, children, icon, or dot changes.

ModeLabel swapIcon swapWidth changeColor transition
motion="subtle" (default)Rise 0.3em, 4 px → 0 px blur, 240 ms / 160 msScale 0.6 → 1, snappy springMorph spring (0.42s, 0.16)240 ms (standard ease)
motion="expressive"Rise 0.3em, 8 px → 0 px blur, 240 ms / 160 msScale 0.6 → 1, snappy springMorph spring (0.42s, 0.16)240 ms (standard ease)
prefers-reduced-motion: reduceOpacity crossfade, 120 msOpacity crossfade, 120 msSnaps immediately120 ms
motion="none"Immediate (0 ms)Immediate (0 ms)Snaps immediatelyImmediate (0 ms)

Tune swap timing with motionOptions.labelDuration (milliseconds) and motionOptions.width (spring or tween transition).

Token groupCSS custom properties
Global theme--ui-surface, --ui-text, --ui-text-secondary, --ui-border, --ui-border-width, --ui-info, --ui-success, --ui-warning, --ui-danger, --ui-font, --ui-font-weight
Pill scale--ui-pill-height, --ui-pill-radius, --ui-pill-pad, --ui-pill-gap, --ui-pill-text-size, --ui-pill-icon-size, --ui-pill-dot-size
Pill colors--ui-pill-teal, --ui-pill-sky, --ui-pill-orchid, --ui-pill-violet, --ui-pill-rose, --ui-pill-amber

UtherealProvider supplies application-wide recipe, theme, and motion defaults below preset and instance props.

Composition

In agent compositions, Pill is a leaf with no actions or persisted state.

{
  "type": "Pill",
  "props": {
    "label": "POST",
    "color": "sky",
    "size": "sm",
    "outline": true,
    "rounded": "default"
  },
  "children": []
}

On this page