"use client"; import type { ReactNode } from "react"; import { Button } from "@/app/components/ui/button"; import { cn } from "@/app/lib/utils"; // A segmented choice (feedback 2026-10-28): one of a few options, as pressed buttons on a neutral grey // track. The chosen one is a raised white segment with a ring and bold text; the others stay grey, so // nothing unchosen reads as "on" (the warm muted brown did). export interface SegmentOption { value: V; label: ReactNode; /** Shown before the label, e.g. a status dot or an error dot. Gets whether the option is chosen. */ lead?: (chosen: boolean) => ReactNode; } export function Segmented({ value, options, onChange, label, disabled = false, className, }: { value: V; options: SegmentOption[]; onChange: (value: V) => void; /** The group's accessible name. */ label: string; disabled?: boolean; className?: string; }) { return (
{options.map((o) => { const chosen = o.value === value; return ( ); })}
); }