Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

NPSScale

  • Stable
  • WCAG 2.2 evidence
  • RTL

Net Promoter Score question: eleven scores from 0 to 10 with low and high anchors. Built on React Aria RadioGroup: each score is a radio named by its number, the anchors describe 0 and 10, Tab enters on the chosen score, arrow keys move and select (mirrored in right-to-left locales), and the score is submitted with name (WCAG 1.3.1, 2.1.1, 4.1.2). Scores are 40 px targets (2.5.8). The chosen score takes its band colour, but the number and the checked state carry the value (1.4.1). The row wraps in narrow containers. Consumer duties: the question wording (label), translated anchors.

import { NPSScale } from "@nexera-ui/react";
Loading example…
4
examples
21
props
6
live controls
1
platform
9
WCAG criteria
1
block uses it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
errorMessage
label
isDisabled
isReadOnly
isRequired
isInvalid
Generated code
import { NPSScale } from "@nexera-ui/react";

<NPSScale />

Examples 3

The same examples as Storybook, rendered live. Open Code to copy one.

Narrow container

The scores wrap in a narrow container; the anchors stay at the two ends.

Loading example…

Long content

Long questions and anchors wrap.

Loading example…

Right to left

Right-to-left: 0 is on the right; arrow keys follow the reading direction.

Loading example…

Props 21

Press "Try it" on a card to load that prop into the playground.

21 props shown

valueNexera
number | null

The chosen score, 0 to 10, or null for none. Controlled; pair it with onChange.

Default –
defaultValueNexera
number | null

The initial score when uncontrolled.

Default null
onChangeNexera
(value: number) => void

Called with the chosen score (0 to 10).

Default –
lowAnchorNexera
ReactNode

Meaning of 0, for example "Not at all likely". Shown under the first score and read as its description. Translate it.

Default –
highAnchorNexera
ReactNode

Meaning of 10, for example "Extremely likely". Shown under the last score and read as its description. Translate it.

Default –
errorMessageNexera
ReactNode

Error text under the scale, shown while the group is invalid (for example isRequired on submit).

Default –
classNameNexera
string

Extra classes for the root, merged last so they win over the defaults.

Default –
styleNexera
CSSProperties

Inline style for the root.

Default –
labelNexera
ReactNode

The question, shown above the scores, for example "How likely are you to recommend us to a friend?". Wraps.

Default –
aria-labelNexera
string

Accessible name when the question is shown elsewhere. Translate it.

Default –
aria-labelledbyNexera
string

Id(s) of the visible element(s) that hold the question.

Default –
validationBehaviorReact Aria
"native" | "aria"

Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.

Default 'native'
nameReact Aria
string

The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).

Default –
isDisabledReact Aria
boolean

Whether the input is disabled.

Default –
isReadOnlyReact Aria
boolean

Whether the input can be selected but not changed by the user.

Default –
isRequiredReact Aria
boolean

Whether user input is required on the input before form submission.

Default –
isInvalidReact Aria
boolean

Whether the input value is invalid.

Default –
validateReact Aria
(value: string) => true | ValidationError | null

A function that returns an error message if a given value is invalid. Validation errors are displayed to the user when the form is submitted if validationBehavior="native". For realtime validation, use the isInvalid prop instead.

Default –
formReact Aria
string

The <form> element to associate the input with. The value of this attribute must be the id of a <form> in the same document. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#form).

Default –
idReact Aria
string

The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).

Default –
aria-describedbyReact Aria
string

Identifies the element (or elements) that describes the object.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

5 direct · 4 supporting
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.4.1Use of ColorLevel A · tested directly
  • 1.4.4Resize TextLevel AA · supporting test
  • 1.4.10ReflowLevel AA · supporting test
  • 2.1.1KeyboardLevel A · tested directly
  • 2.4.7Focus VisibleLevel AA · supporting test
  • 2.5.8Target Size (Minimum)Level AA · supporting test
  • 3.3.1Error IdentificationLevel A · tested directly
  • 4.1.2Name, Role, ValueLevel A · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

  • data-disabled
  • data-hovered
  • data-readonly
  • data-selected
Usage
<NPSScale className="data-disabled:opacity-90 shadow-sm" />

Used in blocks

Related components