This page as markdown: /pill.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

Pill

Status: stable

A chip someone clicks: a filter, a tag choice, an option in a row. Always a button; pass selected to make it a toggle with aria-pressed, and leave it unset on a chip that fires an action. appearance="solid" (filters; selected lifts onto the primary surface) , "outline" (quiet chips that annotate content, like a tag on a card) or "ghost" (nothing drawn at rest, for small toggles under content, like reactions); size lg, md or sm. A static label is a Badge.

Keywords: pill, chip, filter, tag, toggle chip, category

Usage

Use Pill for a row of filters or choices a person clicks to narrow or toggle what they see. For a label that only describes something, use Badge.

Best practices

Props

Name Type Default Description
selected boolean false Marks the pill as chosen. Solid lifts onto the primary surface; outline takes a primary tint and soft primary edge; ghost takes the tint with no edge. Passing it, true or false, sets aria-pressed; left unset the chip is a plain action button.
appearance "solid" | "outline" | "ghost" "solid" solid for a filter row; outline for quiet chips that annotate other content (a tag on a card), where a filled chip would compete with what it annotates; ghost for a run of small toggles under other content (the reactions under a message): nothing drawn at rest, a hover fill, and a primary tint when selected.
size "lg" | "md" | "sm" "md" lg sits on --control-sm (32px, 28 compact), the toolbar rung it shares with SearchInput sm and Button sm, for a filter row beside a search field. md sits on --control-xs (28px, 24 compact), the chip in a row of its own or among content. sm is a fixed 24px (the target floor, which density does not shrink), for chips under or inside other content.
tone "neutral" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "purple" | "pink" "neutral" neutral is the chip as described. A palette family colours it as a category, like the choices in a tag picker: a wash at rest, the solid family colour when selected. Painted from the theme's generated palette.
icon ReactNode — Optional leading glyph (e.g. ), rendered before the children with the base gap.

Variants

Tokens used

palette-wash, palette-wash-strong, palette-edge, palette-solid, palette-text, palette-solid-ink, secondary, secondary-foreground, accent, accent-foreground, primary, primary-foreground, card, border, muted-foreground, foreground

Motion

Accessibility

Related

Examples

Tag picker

import { Pill, Row } from "@sableui/react"

<Row gap={1}><Pill tone="blue" selected onClick={() => {}}>Design</Pill><Pill tone="teal" onClick={() => {}}>Research</Pill><Pill tone="orange" onClick={() => {}}>Marketing</Pill></Row>

Filter row

import { Pill, Row } from "@sableui/react"

<Row gap={1}><Pill selected onClick={() => {}}>All</Pill><Pill onClick={() => {}}>Projects</Pill><Pill onClick={() => {}}>Reports</Pill></Row>

Filters with search

import { Pill, Row, SearchInput } from "@sableui/react"

const [filter, setFilter] = useState("all")
const [q, setQ] = useState("")

<Row gap={2} align="center" justify="between" wrap>
	<Row gap={1}>
		<Pill size="lg" selected={filter === "all"} onClick={() => setFilter("all")}>All 8</Pill>
		<Pill size="lg" selected={filter === "products"} onClick={() => setFilter("products")}>Products 5</Pill>
		<Pill size="lg" selected={filter === "oss"} onClick={() => setFilter("oss")}>Open source 2</Pill>
	</Row>
	<SearchInput size="sm" value={q} onValueChange={setQ} placeholder="Find a project…" aria-label="Find a project" className="max-w-64" />
</Row>

Ghost, small (reactions)

import { Pill, Row } from "@sableui/react"

<Row gap={1}><Pill appearance="ghost" size="sm" selected onClick={() => {}}>🎉 3</Pill><Pill appearance="ghost" size="sm" onClick={() => {}}>👀</Pill></Row>

Outline, small (tags)

import { Pill, Row } from "@sableui/react"

<Row gap={1}><Pill appearance="outline" size="sm" selected onClick={() => {}}>Design</Pill><Pill appearance="outline" size="sm" onClick={() => {}}>Research</Pill></Row>

With icon

import { Icon, Pill } from "@sableui/react"

<Pill icon={<Icon name="lock" />} onClick={() => {}}>Locked</Pill>