import { useId } from "react"; export interface Choice { value: T; label: string; note?: string; // small extra text, e.g. "14d" disabled?: boolean; } /** * A row of single-choice chips — used for providers, forecast views, map layers. * * Each chip is a real radio input, visually hidden; the label is styled from * the input's state with Tailwind's `has-*` variants. Arrow keys move between * chips for free because they're a native radio group. */ export function ChoiceChips({ legend, choices, selected, onChange, size = "md" }: { legend: string; choices: Choice[]; selected: T; onChange: (value: T) => void; size?: "sm" | "md"; }) { const name = useId(); return ( // min-w-0: fieldsets default to min-content width, which would widen the page on phones
{legend} {choices.map((choice) => ( ))}
); }