Components
Radio
A native radio for choosing exactly one option from a short group.
Free
pnpm dlx shadcn@latest add @caliper/radioWhen to use
Use it for
- Two to five mutually exclusive options that should all be visible.
- Settings saved with a form.
Skip it when
- Options need a description; use radio cards.
- The choice switches a view; use a segmented control.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/radio
Adds the file 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 { type ReactNode } from "react" import { Badge } from "@/components/ui/badge" import { Label } from "@/components/ui/label" import { Radio } from "@/components/ui/radio" 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 DigestFrequency() { const periods = [ { id: "docs-daily", value: "monthly", label: "Monthly", price: "$84 / mo" }, { id: "docs-weekly", value: "quarterly", label: "Quarterly", price: "$246 / qtr" }, { id: "docs-never", value: "annual", label: "Annually", price: "$907 / yr", saving: "Save 10%" }, ]; return ( <Panel title="Billing period" context="Team plan · 12 seats · renews 1 November"> <fieldset className="grid gap-1"> <legend className="sr-only">Billing period</legend> {periods.map((period) => ( <Label key={period.id} htmlFor={period.id} className="flex min-h-11 items-center gap-3"> <Radio id={period.id} name="frequency" value={period.value} defaultChecked={period.value === "annual"} /> <span className="flex-1">{period.label}</span> {period.saving && <Badge tone="green">{period.saving}</Badge>} <span className="font-normal tabular-nums text-muted-foreground">{period.price}</span> </Label> ))} </fieldset> </Panel> ); }
API reference
Radio
component
No props of its own; it accepts the native props of its root element.
Accessibility
It is built on native elements and keeps aria-hidden in step with state.
No custom key handling; Tab and the native activation keys do the work.
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.