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

JumpToPage

  • Stable
  • WCAG 2.2 evidence
  • RTL

A small "Go to page [48] of 120" control for long paged lists. Built on React Aria NumberField: the visible label names the field, the total describes it, typed text is parsed in the user's locale (native digits included) and the arrow keys step by 1 (WCAG 1.3.1, 2.1.1, 3.3.2, 4.1.2). Enter submits: a whole number from 1 to pageCount calls onGoToPage; anything else shows an inline error with an icon (never colour alone) and announces it assertively (3.3.1, 3.3.3, 4.1.3). It validates on submit, not on every key press, and nothing is clamped silently. Paste is allowed. The enterkeyhint of the touch keyboard is "go". Consumer duties: translated label, total and error text; going to the page (and announcing it, see Pagination) in onGoToPage. Use it only for lists with many pages.

import { JumpToPage } from "@nexera-ui/react";
Loading example…
6
examples
19
props
3
live controls
1
platform
10
WCAG criteria
0
blocks use 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…
label
isDisabled
isReadOnly
Generated code
import { JumpToPage } from "@nexera-ui/react";

<JumpToPage />

Examples 5

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

Empty

Empty field. Enter with an empty field, or a page outside 1 to 120, shows the error and announces it.

Loading example…

Goes to the page

Wired to a page state, like next to a Pagination: Enter with a valid page goes there.

Loading example…

Disabled

Disabled: not focusable, dimmed text.

Loading example…

Narrow width

A 320 px column: label, field and total wrap onto further lines instead of overflowing; the error wraps too.

Loading example…

Right to left

Right to left: the label starts at the right and the digits are the locale's own.

Loading example…

Props 19

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

19 props shown

pageCount*Nexera
number

Number of pages (the largest page the user can go to). Figma Total shows it as "of 120"; it also bounds the validation to the whole numbers 1 to pageCount.

Default –
labelNexera
string

Visible label and accessible name of the field. Translate it.

Default Go to page
totalLabelNexera
string

Text after the field. Read as the field's description. Translate it and format the number for your locale.

Default `of ${pageCount}` (number formatted for the locale)
errorMessageNexera
string | ((pageCount: number) => string)

Error text shown under the field, with an icon, when Enter is pressed with an empty field or a page outside 1 to pageCount; it is also announced. A function receives pageCount. Say what to enter. Translate it.

Default (pageCount) => `Enter a page from 1 to ${pageCount}`
valueNexera
number

The typed page (controlled). NaN is an empty field. Use with onChange. React Aria commits the text on Enter and on blur, so onChange is not called on every key press.

Default –
defaultValueNexera
number

The page on first render (uncontrolled). NaN or omitted is an empty field.

Default –
onChangeNexera
(value: number) => void

Called with the committed number (NaN when the field is emptied).

Default –
onGoToPageNexera
(page: number) => void

Called with the page when Enter is pressed and the page is valid: a whole number from 1 to pageCount. Go to the page here.

Default –
inputRefNexera
Ref<HTMLInputElement>

Ref to the native <input> (the root ref points to the field wrapper), for example to return focus after navigating.

Default –
classNameNexera
string

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

Default –
styleNexera
CSSProperties

Inline style of the root.

Default –
commitBehaviorReact Aria
"validate" | "snap"

Controls the behavior of the number field when the user blurs the field after editing. 'snap' will clamp the value to the min/max values, and snap to the nearest step value. 'validate' will not clamp the value, and will validate that the value is within the min/max range and on a valid step.

Default 'snap'
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 –
autoFocusReact Aria
boolean

Whether the element should receive focus on render.

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 –
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 –
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 –

* 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

7 direct · 3 supporting
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.4.10ReflowLevel AA · supporting test
  • 1.4.12Text SpacingLevel AA · supporting test
  • 2.1.1KeyboardLevel A · tested directly
  • 2.4.7Focus VisibleLevel AA · supporting test
  • 3.3.1Error IdentificationLevel A · tested directly
  • 3.3.2Labels or InstructionsLevel A · tested directly
  • 3.3.3Error SuggestionLevel AA · tested directly
  • 4.1.2Name, Role, ValueLevel A · tested directly
  • 4.1.3Status MessagesLevel AA · 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
Usage
<JumpToPage className="data-disabled:opacity-90 shadow-sm" />

Used in blocks

No block uses JumpToPage yet.

Related components