InputGroup
An editor with leading and trailing adornments.
- Native host
- New in 0.1
import { InputGroup, inputGroupPrimitive } from "nitro-ui-sdk/input-group";- HeroUI Native
- InputGroup
- Expo UI
- No counterpart

Light 
Dark
On this page
InputGroup places a prefix and suffix around one single-line editor. Use the slots for units, icons or a nearby action that shares the field’s surface.
Anatomy
import { InputGroup } from "nitro-ui-sdk/input-group";
<InputGroup.Root label="Price in dollars">
<InputGroup.Prefix>$</InputGroup.Prefix>
<InputGroup.Input />
<InputGroup.Suffix>USD</InputGroup.Suffix>
</InputGroup.Root>;
| Part | Description |
|---|---|
Root |
Owns the value and draws one field outline. |
Prefix |
Content before the editor. |
Input |
Native editor. |
Suffix |
Content after the editor. |
Usage
import { InputGroup } from "nitro-ui-sdk/input-group";
<InputGroup.Root label="Price in dollars" keyboard="decimal" />;
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 { InputGroup } from "nitro-ui-sdk/input-group";
export function Example() {
const [value, setValue] = useState("");
return <InputGroup.Root label="Price in dollars" value={value} onValueChange={setValue} />;
}
Props
InputGroup.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 |
InputGroupVariant |
"outline" |
Field surface appearance. |
size |
InputGroupSize |
"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<InputGroupPart, InputGroupVariant, InputGroupSize, InputGroupState> |
— | Style resolvers keyed by part. |
api |
Controller<InputGroupActions> |
— | Attach a controller created with the primitive. |
agentId |
string |
— | Identity for replacing a field in a reused view. |
children |
ReactNode |
— | Custom slots. Include exactly one Input. |
InputGroup.Input
| Prop | Type | Default | Description |
|---|---|---|---|
part |
InputGroupPart |
— | Override the style key for this part. |
InputGroup.Prefix and InputGroup.Suffix
| Prop | Type | Default | Description |
|---|---|---|---|
part |
InputGroupPart |
— | Override the style key for this part. |
children |
ReactNode |
— | Content to render inside this part. |
decorative |
boolean |
true for strings |
Hides the adornment from assistive technology. Pass false for an interactive child. |
Controller API
import { InputGroup, inputGroupPrimitive } from "nitro-ui-sdk/input-group";
const api = inputGroupPrimitive.createApi();
const field = <InputGroup.Root label="Price in dollars" 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 { InputGroup } from "nitro-ui-sdk/input-group";
<InputGroup.Root label="Price in dollars" styles={{ suffix: ({ tokens }) => ({ text: { color: tokens.colors.accent } }) }} />;
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. Include the meaning of decorative units in the editor’s name. Interactive adornments keep their own names and are hidden and blocked from touch while the group is disabled. Pass the same disabled value to embedded controls that expose independent actions.
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. |