Input
The bare native editor, for custom field layouts.
- Native host
- New in 0.1
import { Input, inputPrimitive } from "nitro-ui-sdk/input";- HeroUI Native
- Input
- Expo UI
- TextInput

Light 
Dark
On this page
Input is a single-line native editor with field chrome and an accessible name. Use it in custom layouts, or use TextField to get a visible label, helper text and error parts by default.
Anatomy
import { Input } from "nitro-ui-sdk/input";
<Input.Root label="Website">
<Input.Editor />
</Input.Root>;
| Part | Description |
|---|---|
Root |
Owns the value, chrome and focus state. |
Editor |
Mounts the native text editor. |
Usage
import { Input } from "nitro-ui-sdk/input";
<Input.Root label="Website" placeholder="example.com" keyboard="url" />;
Variants and sizes
Choose outline for a 1 pt field border or filled for a secondary surface. The visible heights are 36 pt (sm), 44 pt (md), and 52 pt (lg). Compact one-line fields keep a 44 pt touch target.
States
The focused editor uses the focus border. Invalid fields use the danger border. Disabled fields reduce opacity and reject editing actions.
Controlled
Pass defaultValue for a local value or value with onValueChange to own it. The editor reconciles to the owner’s value after each edit, including a declined request.
import { useState } from "react";
import { Input } from "nitro-ui-sdk/input";
export function Example() {
const [value, setValue] = useState("");
return <Input.Root label="Website" value={value} onValueChange={setValue} />;
}
Props
Input.Root
| Prop | Type | Default | Description |
|---|---|---|---|
label |
string |
Required | Localized name spoken by assistive technology. |
hint |
string |
— | Additional instructions spoken with the field. |
error |
string |
— | Validation message spoken with the field. |
invalid |
boolean |
false |
Applies the invalid appearance. A nonempty error also marks it invalid. |
disabled |
boolean |
false |
Disables editing and reduces opacity. |
variant |
InputVariant |
"outline" |
Field surface appearance. |
size |
InputSize |
"md" |
Visible field size. |
value |
string |
— | Owner-controlled text. |
defaultValue |
string |
"" |
Initial text in uncontrolled mode. |
onValueChange |
(value: string, details: ActionDetails) => void |
— | Receives the requested text. Call details.preventDefault() to decline. |
onValueCommit |
(value: string, details: ActionDetails) => void |
— | Runs once per accepted edit that changes the value. |
placeholder |
string |
— | Native placeholder. |
keyboard |
TextKeyboard |
"default" |
Native keyboard layout. |
contentType |
TextContentType |
— | Autofill hint, such as "email" or "username". |
autocapitalize |
TextCapitalization |
"sentences" |
Capitalization mode. |
autocorrect |
boolean |
true |
Use OS autocorrection. |
returnKey |
TextReturnKey |
"default" |
Native Return key label. |
maxLength |
number |
— | Maximum number of UTF-16 code units. |
onSubmit |
(value: string, details: ActionDetails) => void |
— | Receives the committed text on Return or submit. |
styles |
PartStyles<InputPart, InputVariant, InputSize, InputState> |
— | Style resolvers keyed by part. |
api |
Controller<InputActions> |
— | Attach a controller created with the primitive. |
agentId |
string |
— | Identity for replacing a field in a reused view. |
children |
ReactNode |
— | Compound anatomy override. |
Input.Editor
| Prop | Type | Default | Description |
|---|---|---|---|
part |
InputPart |
— | Override the style key for this part. |
Controller API
import { Input, inputPrimitive } from "nitro-ui-sdk/input";
const api = inputPrimitive.createApi();
const field = <Input.Root label="Website" api={api} />;
// Use api.current after the field mounts.
export { field, api };
| Action | Signature | Result |
|---|---|---|
focus |
(source?: ActionSource) => ActionStatus |
Focuses the editor when it is available. |
blur |
(source?: ActionSource) => ActionStatus |
Dismisses native editing. |
setValue |
(value: string, source?: ActionSource) => ChangeStatus |
Requests a new value. |
clear |
(source?: ActionSource) => ChangeStatus |
Requests an empty value. |
submit |
(source?: ActionSource) => ActionStatus |
Calls the submit handler with the current text. |
Controlled edits return requested while the owner renders. Agent calls resolve after that commit.
Styles
import { Input } from "nitro-ui-sdk/input";
<Input.Root label="Website" styles={{ root: ({ tokens }) => ({ style: { cornerRadius: tokens.radius.card } }) }} />;
Resolvers receive tokens, variant, size, and state. State includes disabled, invalid, focused, and empty.
Accessibility
The native editor speaks label as its name and reads error before hint. Editing, selection and dictation are platform-owned. Supply a localized label even when the editor has a visible placeholder.
Agent API
| Action | Arguments | Notes |
|---|---|---|
focus |
None | Focus the editor. |
setValue |
String | Request a value. Controlled owners can decline. |
clear |
None | Request an empty value. |
submit |
None | Available when onSubmit is set. |
Platform notes
| iOS | Android | |
|---|---|---|
| Implementation | UIKit text field with native selection, keyboard and IME. | Android EditText with native selection, keyboard and IME. |
| Verification | Native iOS harness in the example app. | Kotlin is written for Android. The Android NDK is unavailable on this machine, so no Android build was run. |