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

Input

  • Needs review
  • WCAG 2.2 evidence
  • RTL
  • Web · iOS · Android

Single-line text field: label, a field box with optional leading and trailing icons, helper text and an inline error. Built on React Aria TextField: the label, helper and error are linked to the input (WCAG 1.3.1, 3.3.2), aria-invalid is set while invalid, and with isRequired / validate / native constraints the error appears on submit, focus moves to the first invalid field and its error is read with it (3.3.1, 4.1.3). The error shows an icon and text, never colour alone (1.4.1). Focus draws the brand border and the focus halo on the box (2.4.7). Paste, autofill and password managers are never blocked (3.3.7, 3.3.8). Consumer duties: label, helper and error wording; the right autoComplete token for personal data (1.3.5); explaining why a field is disabled.

import { Input } from "@nexera-ui/react";
Loading example…
8
examples
36
props
8
live controls
3
platforms
16
WCAG criteria
20
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…
description
placeholder
size
platform
isDisabled
isReadOnly
isRequired
isInvalid
Generated code
import { Input } from "@nexera-ui/react";

<Input />

Examples 7

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

Sizes

Every Figma Size (32 / 40 / 48 px). Hover, click and tab into the fields to see the states.

Loading example…

With icons

leadingIcon and trailingIcon. Both are decorative.

Loading example…

States

Semantic states: isDisabled, isInvalid + errorMessage, filled and read-only.

Loading example…

Validation on submit

Validation on submit: the error appears under the field with an icon, focus moves to the first invalid field and the error is read with it. Autofill attributes are forwarded (autoComplete, type, inputMode) and paste is never blocked.

Loading example…

Platforms

Figma Input Mobile: iOS 50 pt and Android 52 dp boxes (radius 12, padding 16 / 12, 20 px icons, Body/Large).

Loading example…

Long label

Long labels and helper texts wrap; the value scrolls inside the box.

Loading example…

Right to left

Right-to-left: label, icon and padding mirror (logical properties).

Loading example…

Props 36

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

36 props shown

descriptionNexera
ReactNode

Helper text under the field. Explains the expected format before an error happens; linked to the input with aria-describedby. Shown when provided.

Default –
errorMessageNexera
ReactNode | ((validation: ValidationResult) => ReactNode)

Error text under the field, shown with an icon while the field is invalid (isInvalid, or a failed isRequired / validate / native constraint after submit) and linked with aria-describedby. Say what is wrong and how to fix it. A function receives React Aria's validation result. Defaults to the browser's validation message.

Default –
placeholderNexera
string

Example value shown while the field is empty, for example "e.g. Ayesha Khan". Never the only label: it disappears on typing and is not an accessible name.

Default –
sizeNexera
"sm" | "md" | "lg"

Height and type: 32 / 40 / 48 px on web with Body/Small, Body/Default and Body/Large. On iOS and Android the platform tokens give 44 / 50 / 56 pt and 48 / 52 / 56 dp, always with Body/Large.

Default "sm" on web, "md" on iOS and Android (Figma `Input Mobile`: 50 pt / 52 dp)
platformNexera
"web" | "ios" | "android"

Platform look. Defaults to the NexeraProvider platform.

Default "web"
leadingIconNexera
ReactNode

Icon before the value. Decorative: hidden from assistive technology. 16 px (20 px at lg and on iOS and Android).

Default –
trailingIconNexera
ReactNode

Icon after the value. Decorative: hidden from assistive technology, so it must not be the only way to show a state or trigger an action.

Default –
inputRefNexera
Ref<HTMLInputElement>

Ref to the native <input> (the root ref points to the field wrapper).

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

Visible label, linked to the control by React Aria (WCAG 1.3.1, 3.3.2). Short noun, for example "Work email". Wraps instead of truncating. A placeholder is never a substitute for it. Not set: the field has no visible label. Not set: the field has no visible label of its own.

Default –
aria-labelNexera
string

Accessible name when it must differ from the visible label. Prefer the visible label (WCAG 2.5.3). Accessible name. Required when there is no visible label; translate it. Accessible name. Optional when aria-labelledby is set.

Default –
aria-labelledbyNexera
string

Id(s) of element(s) that name the field; wins over the visible label. Id(s) of element(s) that name the field; wins over aria-label. Id(s) of visible element(s) that name the field.

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'
enterKeyHintReact Aria
"search" | "enter" | "done" | "go" | "next" | "previous" | "send"

An enumerated attribute that defines what action label or icon to preset for the enter key on virtual keyboards. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint).

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

Whether the element should receive focus on render.

Default –
valueReact Aria
string

The current value (controlled).

Default –
defaultValueReact Aria
string

The default value (uncontrolled).

Default –
onChangeReact Aria
(value: string) => void

Handler that is called when the value changes.

Default –
aria-describedbyReact Aria
string

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

Default –
idReact Aria
string

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

Default –
autoCompleteReact Aria
string

Describes the type of autocomplete functionality the input should provide if any. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete).

Default –
maxLengthReact Aria
number

The maximum number of characters supported by the input. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefmaxlength).

Default –
minLengthReact Aria
number

The minimum number of characters required by the input. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefminlength).

Default –
patternReact Aria
string

Regex pattern that the value of the input must match to be valid. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefpattern).

Default –
typeReact Aria
"search" | "text" | "url" | "tel" | "email" | "password" | (string & {})

The type of input to render. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdeftype).

Default 'text'
inputModeReact Aria
"search" | "none" | "text" | "url" | "tel" | "email" | "numeric" | "decimal"

Hints at the type of data that might be entered by the user while editing the element or its contents. See [MDN](https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute).

Default –
autoCorrectReact Aria
string

An attribute that takes as its value a space-separated string that describes what, if any, type of autocomplete functionality the input should provide. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#autocomplete).

Default –
spellCheckReact Aria
string

An enumerated attribute that defines whether the element may be checked for spelling errors. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck).

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

11 direct · 5 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.3.5Identify Input PurposeLevel AA · tested directly
  • 1.4.1Use of ColorLevel A · tested directly
  • 1.4.10ReflowLevel AA · supporting test
  • 1.4.11Non-text ContrastLevel AA · supporting test
  • 1.4.12Text SpacingLevel 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
  • 3.3.2Labels or InstructionsLevel A · tested directly
  • 3.3.3Error SuggestionLevel AA · tested directly
  • 3.3.7Redundant EntryLevel A · tested directly
  • 3.3.8Accessible Authentication (Minimum)Level AA · 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-focus-within
  • data-invalid
Usage
<Input className="data-focus-within:opacity-90 shadow-sm" />

Used in blocks

Related components