Single Select
Open in playgroundPick one option from a list. Supports an optional freeform note for extra context, and tapping a selected option clears it.
Preview
Usage
import { SingleSelect } from "@/components/socratic-ui/single-select";
const [value, setValue] = useState<string | null>(null);
<SingleSelect
question="How are you building this product?"
options={[
{ title: "Solo founder" },
{ title: "Co-founding team" },
]}
value={value}
onChange={setValue}
/>
API Reference
| Prop | Type | Default |
|---|---|---|
questionrequiredThe headline shown above the options. | string | — |
subtitleOptional supporting copy beneath the question. | string | — |
optionsrequiredThe list of selectable options. | { title: string; subtitle?: string }[] | — |
valuerequiredTitle of the currently selected option, or null. | string | null | — |
onChangerequiredCalled when the selection changes. Tapping a selected option clears it. | (value: string | null) => void | — |
numberOptional leading question number, e.g. "01". | string | — |
freeformPlaceholderWhen provided, renders an extra textarea beneath the options. | string | — |
freeformValueControlled value for the freeform textarea. | string | — |
onFreeformChangeControlled setter for the freeform textarea. | (value: string) => void | — |