Spectrum
Open in playgroundA slider between two labeled poles. Surfaces shades of grey that a radio group collapses — neither ‘A nor B’ but ‘slightly toward A’. Pole tiles light up as the slider crosses the midpoint.
Preview
Usage
import { Spectrum } from "@/components/socratic-ui/spectrum";
<Spectrum
question="What's your building philosophy?"
leftLabel="Move fast"
leftDescription="Ship now, fix later"
rightLabel="Methodical"
rightDescription="Measure twice, cut once"
value={value}
onChange={setValue}
/>
API Reference
| Prop | Type | Default |
|---|---|---|
questionrequiredThe headline shown above the slider. | string | — |
subtitleOptional supporting copy beneath the question. | string | — |
leftLabelrequiredLabel for the low end of the slider. | string | — |
leftDescriptionOptional one-liner describing the left pole. | string | — |
rightLabelrequiredLabel for the high end of the slider. | string | — |
rightDescriptionOptional one-liner describing the right pole. | string | — |
minMinimum slider value. | number | 0 |
maxMaximum slider value. | number | 100 |
stepStep increment between slider stops. | number | 1 |
valuerequiredCurrent slider value. | number | — |
onChangerequiredCalled as the slider moves. | (value: number) => void | — |
numberOptional leading question number. | string | — |
motionOpt-in entrance animation config. Omit for static rendering; pass `{ enabled: true }` (or a preset from `motion.ts`) to animate in on mount. | SocraticMotion | — |