// Adapted from Kibo UI (MIT), with owned React/CSS APIs. See THIRD_PARTY_NOTICES.md. "use client"; import { useId, useState, type ComponentProps, type ReactNode } from "react"; export interface ChoiceboxOption { value: string; label: ReactNode; description?: ReactNode; disabled?: boolean; } export type ChoiceboxProps = Omit< ComponentProps<"fieldset">, "onChange" | "defaultValue" > & { label: string; options: readonly ChoiceboxOption[]; name?: string; value?: string; defaultValue?: string; onValueChange?: (value: string) => void; required?: boolean; }; export function Choicebox({ label, options, name, value, defaultValue = "", onValueChange, required, className = "", disabled, ...props }: ChoiceboxProps) { const id = useId(); const [internal, setInternal] = useState(defaultValue); return (
{label} {options.map((option) => ( ))}
); }