CentercodeDitto
DittoPorygonAPI

NpsScaleInput

0-10 numeric scale selector for Net Promoter Score

Overview

NpsScaleInput renders 11 numbered buttons (0-10) in a horizontal row with endpoint labels. Implements ARIA radiogroup pattern with arrow-key navigation. Used by the NPS DynamicBlock renderer for collecting Net Promoter Scores.

import { NpsScaleInput } from '@/ui/components/nps-scale-input';

Props

PropTypeDefaultDescription
valuenumber | nullrequiredCurrently selected score (0-10), or null if unselected
onChange(value: number) => voidrequiredCallback when score changes
lowLabelstring-Label for the low end (0) of the scale. Defaults to i18n "Not at all likely"
highLabelstring-Label for the high end (10) of the scale. Defaults to i18n "Extremely likely"
disabledbooleanfalseWhether the input is disabled
ariaLabelstring-Accessible label for the radiogroup (question text)
ariaLabelledBystring-ID of the element that labels this group
classNamestring-Additional className for the container

Default (Unselected)

No value selected. Default endpoint labels are applied via i18n.

Not at all likelyExtremely likely

Selected: none

Custom Labels

Custom endpoint labels can be provided via props.

TerribleOutstanding

Selected: none

Without Labels

Passing empty strings hides the endpoint labels while keeping the scale functional.

Selected: none

Pre-filled Value

A value can be pre-selected to show existing data or defaults.

Not at all likelyExtremely likely

Selected: 8

Compact Context

In a narrow container, the scale remains usable with constrained width.

LowHigh

Selected: 6

Disabled

Disabled state for canvas/preview mode. Buttons are non-interactive with reduced opacity.

Not at all likelyExtremely likely