Components
Select menu
A select whose list opens with the chosen option over the trigger; the platform picker on touch.
pnpm dlx shadcn@latest add @caliper/select-menuWhen to use
Use it for
- Five to fifteen options where a short code helps, like regions or currencies.
- Desktop forms where the list should grow around what you already read.
Skip it when
- Options need search; use a combobox.
- Two to five options; a segmented control is faster.
Installation
pnpm dlx shadcn@latest add @caliper/select-menu
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.
import { useState, type ReactNode } from "react" import { Label } from "@/components/ui/label" import { SelectMenu } from "@/components/ui/select-menu" 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> ); } const regionOptions = [ { value: "eu-central-1", label: "Frankfurt", code: "eu-central-1" }, { value: "eu-west-1", label: "Dublin", code: "eu-west-1" }, { value: "eu-west-2", label: "London", code: "eu-west-2" }, { value: "us-east-1", label: "Ashburn", code: "us-east-1" }, { value: "us-west-2", label: "Oregon", code: "us-west-2" }, { value: "ap-northeast-1", label: "Tokyo", code: "ap-northeast-1" }, { value: "ap-southeast-2", label: "Sydney · at capacity", code: "ap-southeast-2", disabled: true }, ]; const regionHints: Record<string, string> = { "eu-central-1": "Closest to most of your team", "eu-west-1": "18 ms from Frankfurt", "eu-west-2": "UK data residency", "us-east-1": "92 ms from Frankfurt", "us-west-2": "148 ms from Frankfurt", "ap-northeast-1": "231 ms from Frankfurt", }; export function RegionMenu() { const [region, setRegion] = useState("eu-west-1"); return ( <div className="grid w-full justify-items-center py-12"> <Panel title="Data residency" context="Where Atlas platform stores customer records" className="max-w-sm"> <div className="grid gap-1.5"> <Label id="docs-region-menu-label">Primary region</Label> <SelectMenu aria-labelledby="docs-region-menu-label" name="region" options={regionOptions} value={region} onValueChange={setRegion} /> <p className="text-xs text-muted-foreground" role="status">{regionHints[region]}</p> </div> </Panel> </div> ); }
API reference
SelectMenu
component
Also accepts the native props of its root element and a ref.
Accessibility
It exposes dialog, combobox, listbox and option semantics, with aria-hidden, aria-haspopup, aria-expanded, aria-controls, aria-labelledby and aria-label kept in step with state.
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.