Native Web Components playground

Nova v3.37.0

Preview

Web Components

Pill

nv-pill

A compact, selectable chip for filtering and choosing options.

Live demo

Leading Icon

Pills are interactive: people select them to filter a list or choose options. To label content, use a tag; to show a non-interactive status, use a status indicator.

Anatomy

A selected pill with a light-bulb icon, the label Label and a check mark. Callout 1 marks the container, 2 the leading icon, 3 the label and 4 the check mark.

The parts of a selected pill.
  1. Container with rounded edges; its border and fill show the state.
  2. Leading icon (optional), set with leadingIcon or the leading-icon slot.
  3. Label names the option; set it with label.
  4. Check mark appears while the pill is selected.

States and selection

Pills have default, hover, selected and disabled states and no colour variants. Clicking a pill or pressing Enter or Space toggles selected and emits toggled. As direct children of an element with role="radiogroup", pills with pillAriaRole="radio" allow one choice and support the arrow keys.

The whole pill is the interaction target. Its neutral base and brand-coloured hover and selected states communicate behaviour; do not assign category colours or override the state colours. Keep the label visible, because it also provides the accessible name.

The design's active or selected appearance maps to selected; the component does not have an active prop.

default
selected
leadingIcon
disabled

Guidelines

  • Use pills to turn filters on and off or to choose from a short list.
  • Keep labels short and action- or option-oriented.
  • Do not use pills for static categories or system status.

Use several pills for independent filters or multiple attributes, and radio semantics when only one option is allowed. The design also suggests compact secondary actions: handle toggled to respond to the choice. If the action should not leave a selected state, use a button.

DoLet people filter a list or choose options with short labels.
Don'tAvoid pills for a status that people cannot change; use a tag or status indicator.

Sources