Prepared Docs

Prepared Docs

⌘K

    Loading navigation…

User

  1. Components
  2. Pill
  3. API and Development

Pill

API and Development

View Source
Submit Issue

Pill displays compact, rounded badges for categorizing, tagging, or displaying short pieces of information with optional icons and dismiss functionality. It provides a versatile badge component supporting multiple size and color variants, icons, interactive behavior, and dismiss functionality. Built on Radix UI's Badge component, it ensures consistent pill patterns across the interface with full keyboard and screen reader accessibility.

Props

Name

Type

Default

Description

color

PillColor

PillColor.Default

Semantic color variant for the pill.

disabled

boolean

false

When true, disables interaction on the pill.

dismissible

boolean

false

—

external

boolean

false

When true with href, opens in a new tab with rel="noopener noreferrer".

href

string

—

When set, renders the pill as a link instead of a button-like control.

icon

SVGAsset

—

Optional SVG icon displayed before the pill text.

interactionType

InteractableType

InteractableType.Default

Visual style variant when the pill is interactive.

onClick

((e: MouseEvent<HTMLSpanElement, MouseEvent>) => void)

—

Click handler that makes the pill interactive.

onDismiss

MouseEventHandler<HTMLElement>

—

—

onMouseEnter

((e: MouseEvent<HTMLSpanElement, MouseEvent>) => void)

—

Mouse enter handler for hover interactions.

onMouseLeave

((e: MouseEvent<HTMLSpanElement, MouseEvent>) => void)

—

Mouse leave handler for hover interactions.

size

PillSize

PillSize.Regular

Controls the pill dimensions and font size.

Storybook

Interactive examples and edge cases for this component are in Storybook.

Default
Small
Regular
Large
Info
Success
Warning
Error
Lime
Cyan
Purple
Violet
Pink
Sizes With Icon
Interactable Pill
Dismissable Pill

Basic Pill

Use for simple labels or categorization without interaction.

Size Variants

Choose size based on context and content density.

Small

Use in tight spaces or dense layouts.

Regular

Default size for most use cases.

Large

Use for prominent tags or when increased visibility is needed.

Color Variants

Use color variants to convey semantic meaning or visual hierarchy.

Default

Use for neutral categorization without specific semantic meaning.

Info

Indicates informational content or items that merit awareness.

Success

Indicates success, completion, or positive states.

Warning

Highlights caution or intermediate states that need attention.

Error

Signals errors, failures, or critical issues.

With Icons

Add icons to provide visual context or quick recognition.

Dismissible Pills

Enable dismissal for removable tags or filters. The dismiss control is an IconToggle with a dedicated container class so icon fill and sizing stay consistent with the pill variant.

Interactive Pills

Make pills clickable for navigation or action triggers.

Link Pills

Pass href to render the pill as an anchor. Use external for a new-tab link with an external-link icon and accessible new-window announcement.

When href and dismissible are both set, the dismiss control renders as a sibling of the anchor so a dismiss click does not navigate. disabled drops href, target, and rel, and exposes aria-disabled.

Interactive with Custom Styling

Use interaction types to control hover and focus styling.

Disabled Interactive Pills

Disable interactive pills when actions are unavailable.

With Mouse Events

Handle hover states for enhanced interactivity.

Dismissible with Icon

Combine icons and dismiss functionality.

Size Comparison

Compare different sizes side by side.

Color Comparison

Compare different color variants.

Previous

Pill / Usage

Next

Pill / Accessibility

On this page

Props
Storybook
Basic Pill
Size Variants
Small
Regular
Large
Color Variants
Default
Info
Success
Warning
Error
With Icons
Dismissible Pills
Interactive Pills
Link Pills
Interactive with Custom Styling
Disabled Interactive Pills
With Mouse Events
Dismissible with Icon
Size Comparison
Color Comparison