Components
Chip group
A set of toggleable chips for single or multiple choices.
Free
pnpm dlx shadcn@latest add @caliper/chip-groupWhen to use
Use it for
- A handful of filters or channels that are always visible.
- Choices that read as short labels.
Skip it when
- More than eight options; use a multi-select.
- Options need explanation; use radio cards.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/chip-group
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
This is the code behind the preview above.
example.tsx
import { useState, type ReactNode } from "react" import { ChipGroup } from "@/components/ui/chip-group" function Panel({ title, context, className = "max-w-md", children }: { title: string; context: string; className?: string; children: ReactNode }) { return ( <section className={`grid w-full gap-5 rounded-overlay border border-border bg-background p-6 shadow-resting ${className}`}> <div className="grid gap-1"> <p className="font-medium">{title}</p> <p className="text-sm text-muted-foreground">{context}</p> </div> {children} </section> ); } export function ChannelChips() { const [selected, setSelected] = useState<string | string[]>(["email", "slack"]); return ( <Panel title="Incident alerts" context="How the on-call team hears about a P1" className="max-w-sm"> <ChipGroup label="Channels" options={[ { value: "email", label: "Email" }, { value: "push", label: "Push" }, { value: "sms", label: "SMS" }, { value: "slack", label: "Slack" }, ]} value={selected} onValueChange={setSelected} /> </Panel> ); }
API reference
ChipGroup
component
PropTypeDefault
label *string—
options *readonly ChipOption[]—
valuestring | readonly string[]—
defaultValuestring | readonly string[]—
onValueChange((value: string | string[]) => void)—
selection"multiple" | "single""multiple"
namestring—
classNamestring—
Accessibility
It is built on native elements and keeps aria-disabled, aria-label, aria-checked and aria-pressed in step with state.
KeyBehaviour
→Moves to the next item or value.
↓Moves to the next item or value.
←Moves to the previous item or value.
↑Moves to the previous item or value.
Motion
It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.