Scale
A row of numbers to pick one from: a satisfaction scale, an NPS question.
import { Scale } from "@forgeron/ui";How satisfied are you?
import { Scale } from "@forgeron/ui";
export default function Satisfaction() {
return (
<Scale
label="How satisfied are you?"
min={1}
max={5}
lowLabel="Not at all"
highLabel="Very"
defaultValue={4}
/>
);
}How likely are you to recommend us to a colleague?
import { Scale } from "@forgeron/ui";
export default function Nps() {
return (
<Scale
nps
label="How likely are you to recommend us to a colleague?"
lowLabel="Not likely"
highLabel="Very likely"
defaultValue={9}
/>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | The question, said once for the whole row. |
value / defaultValue | number | null | — | Controlled or not. |
onChange | (value: number | null) => void | — | On every change. |
min / max | number | 0 / 10 | First and last number. |
lowLabel / highLabel | string | — | Under the first and last number. |
nps | boolean | — | Colours the chosen number: 0–6 danger, 7–8 warning, 9–10 success. |
readOnly | boolean | — | Shows the answer. |
disabled | boolean | — | Not editable. |
className | string | — | Extra classes. |