Skip to Content
ARCUI

Input

ARCUI single-line text field with native controlled or uncontrolled ownership, field-state motion, clear behavior, icons, loading, and accessible trailing actions.

Input keeps React Native TextInput ownership semantics while adding ARCUI field presentation, token-driven states, UI-thread visual transitions, centralized font scaling, and predictable trailing-slot behavior.

Usage

The common controlled form mirrors native TextInput ownership.

import { Input } from "react-native-arc-ui";
import { useState } from "react";

export function Example() {
  const [email, setEmail] = useState("");

  return (
    <Input
      label="Email"
      type="email"
      value={email}
      onChangeText={setEmail}
      placeholder="name@example.com"
    />
  );
}

Value ownership

Input supports the two native text ownership modes, but a mounted instance must keep the same mode for its lifetime.

Controlled

Pass value and update it from onChangeText.

const [name, setName] = useState("");

<Input label="Name" value={name} onChangeText={setName} />;

The consumer is the text source of truth.

Uncontrolled

Use defaultValue when native TextInput should own the text value.

<Input label="Name" defaultValue="Vladimir" />

ARCUI does not mirror the uncontrolled string into React state. It tracks only whether the native field currently has text so value-dependent presentation and clear affordances remain correct.

Switching a mounted Input between controlled and uncontrolled ownership throws a clear runtime error. Remount with a different key if the ownership model genuinely needs to change.

Input presets

type is a convenience layer over native TextInput props.

text  -> normal text behavior
email -> email-address keyboard, no auto-capitalization, no auto-correct
phone -> phone-pad keyboard
url   -> URL keyboard, no auto-capitalization, no auto-correct

type="text" is the default.

<Input label="Email" type="email" />
<Input label="Phone" type="phone" />
<Input label="Website" type="url" />

Explicit native props are spread after the preset, so consumer TextInputProps can override preset values where appropriate.

Label, focus, and value state

label renders ARCUI-owned field text above the native input and becomes the default accessibility label when no explicit accessibilityLabel is provided.

Focus is event-driven. Native onFocus/onBlur update a Reanimated SharedValue directly rather than routing focus animation through React state.

<Input
  label="Project name"
  value={name}
  onChangeText={setName}
  onFocus={() => console.log("focused")}
  onBlur={() => console.log("blurred")}
/>

The border also distinguishes empty and populated values while unfocused.

Validation

A non-empty error string enables error presentation and mounts an accessible alert row.

<Input
  label="Email"
  value={email}
  onChangeText={setEmail}
  error={isValid ? undefined : "Enter a valid email address"}
/>

Error has visual priority over focus. The error row uses ARCUI entering/exiting behavior and announces validation through native alert semantics.

Disabled and inactive

disabled and active={false} both prevent editing, but represent different ARCUI presentation states.

<Input label="Account ID" value="A-1048" disabled />

<Input label="Calculated value" value="42" active={false} />
  • disabled is the fully disabled semantic state;
  • active={false} keeps ARCUI's inactive presentation while removing the field from normal editing flow.

Input also respects native editable={false}. ARCUI resolves editing availability from all three constraints.

Clearable input

clearable defaults to true.

The built-in clear action appears only when:

  • the input currently has text;
  • loading is not active;
  • neither iconRight nor rightAction owns the trailing slot;
  • the native field is currently editable.
<Input
  label="Search"
  value={query}
  onChangeText={setQuery}
  clearable
/>

In controlled mode, pressing clear requests onChangeText(""); the consumer still owns the actual value prop. In uncontrolled mode ARCUI clears the native TextInput and also emits onChangeText("") when provided.

The clear button uses the localizable inputClearAccessibilityLabel ARCUI string.

Icons and trailing actions

Left icon

iconLeft is a decorative ARCUI icon.

<Input iconLeft="search" placeholder="Search components" />

Decorative right icon

iconRight is also decorative.

<Input iconRight="info" value={value} onChangeText={setValue} />

Interactive right action

Use rightAction when the trailing icon performs an action.

<Input
  value={query}
  onChangeText={setQuery}
  rightAction={{
    icon: "search",
    accessibilityLabel: "Search",
    accessibilityHint: "Runs the current search query",
    onPress: submitSearch,
  }}
/>

rightAction and iconRight are mutually exclusive. ARCUI validates this invariant at runtime for JavaScript and dynamic-prop consumers.

Because rightAction is icon-only, a non-empty accessibilityLabel is required.

Trailing-slot priority

Only one trailing affordance owns the slot at a time.

loading
> rightAction / iconRight
> clear action

This prevents overlapping controls and keeps mounted transitions predictable.

Loading

loading replaces the current trailing affordance with an ARCUI SpinnerLoader.

<Input
  label="Username"
  value={username}
  onChangeText={setUsername}
  loading={checkingAvailability}
/>

Loading does not automatically make the text field non-editable. It owns trailing feedback and contributes busy: true to the native accessibility state.

Ref

Input follows the React 19 ref-as-prop pattern and exposes the underlying native TextInput.

import { useRef } from "react";
import { TextInput } from "react-native";
import { Input } from "react-native-arc-ui";

const inputRef = useRef<TextInput>(null);

<Input ref={inputRef} label="Name" />;

inputRef.current?.focus();

ARCUI uses the same native instance internally for field focusing and uncontrolled clearing.

Native TextInput props

Input inherits supported TextInputProps, including examples such as:

<Input
  autoComplete="email"
  returnKeyType="next"
  onSubmitEditing={focusNextField}
  selectionColor="#999"
  accessibilityHint="Used for account recovery"
/>

ARCUI intentionally owns or omits native fields that would conflict with its single-line field architecture or manual ARCUI font scaling, including style, multiline, scrollEnabled, allowFontScaling, maxFontSizeMultiplier, placeholderTextColor, and the native testID location.

Styling

style applies to the ARCUI field root. inputStyle applies to the native TextInput text surface.

<Input
  label="Reference"
  style={{ marginTop: 16 }}
  inputStyle={{ fontWeight: "600" }}
/>

Field geometry, border width, radius, spacing, typography, and semantic colors are normally configured through ARCUI tokens rather than repeated per-instance style overrides.

Testing

testID is applied to the ARCUI field root and produces stable descendants for owned elements.

<Input
  testID="email-input"
  label="Email"
  value={email}
  onChangeText={setEmail}
/>

Possible descendants include:

email-input-label
email-input-input
email-input-icon-left
email-input-icon-right
email-input-action
email-input-clear
email-input-loading
email-input-error

Only descendants that are actually rendered exist at a given time.

For provider setup and the dedicated react-native-arc-ui/testing entrypoint, see Testing.

API Reference

Input With Decorative Right Icon

Also inherits: TextInputProps

PropTypeDefaultDescription
ref?Ref<TextInput>—React 19 ref-as-prop.
label?string——
error?string——
disabled?booleanfalseFully disabled semantic state.
active?booleantrueWhether the field is currently active in the interaction flow. active=false uses ARCUI's inactive presentation and prevents editing without representing the field as the disabled visual state.
type?TInputType"text"Convenience preset for native TextInput behavior. Explicit native TextInput props override the preset.
iconLeft?TIconType—ARCUI-owned decorative built-in icon.
clearable?booleantrueWhether the clear action appears while the field has text. Priority: loading > rightAction/iconRight > clearable
loading?booleanfalseShows loading feedback in the trailing slot.
style?StyleProp<ViewStyle>—Root field style. Use inputStyle for the native TextInput itself.
inputStyle?StyleProp<TextStyle>——
testID?string—Applied to the ARCUI field root. The native TextInput receives `${testID}-input`.
iconRight?TIconType—ARCUI-owned decorative trailing icon.

Input With Right Action

Also inherits: TextInputProps

PropTypeDefaultDescription
ref?Ref<TextInput>—React 19 ref-as-prop.
label?string——
error?string——
disabled?booleanfalseFully disabled semantic state.
active?booleantrueWhether the field is currently active in the interaction flow. active=false uses ARCUI's inactive presentation and prevents editing without representing the field as the disabled visual state.
type?TInputType"text"Convenience preset for native TextInput behavior. Explicit native TextInput props override the preset.
iconLeft?TIconType—ARCUI-owned decorative built-in icon.
clearable?booleantrueWhether the clear action appears while the field has text. Priority: loading > rightAction/iconRight > clearable
loading?booleanfalseShows loading feedback in the trailing slot.
style?StyleProp<ViewStyle>—Root field style. Use inputStyle for the native TextInput itself.
inputStyle?StyleProp<TextStyle>——
testID?string—Applied to the ARCUI field root. The native TextInput receives `${testID}-input`.
rightActionTInputRightActionrequiredInteractive trailing action. Mutually exclusive with iconRight.

Generated from the ARCUI 1.1.x TypeScript source snapshot. Native inherited props remain available through the referenced React Native surface.

The generated table covers ARCUI-owned public props. Supported native TextInputProps remain available through the inherited surface described above.

Motion

Input keeps independent visual axes rather than forcing field state through one ordinal state machine.

Shared visual progress exists for:

  • focus;
  • error;
  • disabled;
  • inactive;
  • value presence.

Border priority is explicit:

disabled
> inactive
> error
> focused
> has value
> empty

Focus/blur changes update SharedValues directly from native callbacks. Prop-driven semantic axes synchronize independently and support cancellation/reversal. Trailing-slot and error mounting use ARCUI entering/exiting behavior.

Reduced Motion snaps semantic field transitions to their requested target instead of leaving stale in-flight animation.

See Motion.

Performance

Normal typing remains native/React Native TextInput behavior. ARCUI does not put focus animation on React state, and field color calculations are resolved as a compact Reanimated graph rather than a chain of React rerenders.

For uncontrolled fields, ARCUI mirrors only empty/non-empty presence—not the full text value—because native TextInput remains the source of truth.

See Performance.

Accessibility

Input preserves native text-input semantics while ARCUI owns surrounding field behavior.

  • accessibilityLabel falls back to label;
  • disabled accessibility state follows disabled || active === false;
  • loading contributes busy state;
  • clear uses a localizable ARCUI-owned accessibility label;
  • rightAction requires its own accessible name;
  • validation is rendered as a polite alert;
  • ARCUI-rendered text uses the central font-scale SharedValue with native scaling disabled to avoid double scaling.

Consumer accessibilityHint, compatible accessibility state, and supported native TextInput accessibility props remain available.

See Accessibility.

Theming

Input presentation is driven by field tokens and the active ARCUI theme. Relevant areas include:

colors.light.input
colors.dark.input
border.input
radius.input
sizings.input
typography.input
spacing
animations
enteringExiting

Input colors cover empty/populated borders, focused, validation, inactive, disabled, label, text, placeholder, icons, clear action, and field background.

Top-level token overrides are shallow. Compose changed namespaces from defaultTokens.

import { ARCUI, defaultTokens, type TTokensOverride } from "react-native-arc-ui";

const tokens = {
  radius: {
    ...defaultTokens.radius,
    input: 12,
  },
  border: {
    ...defaultTokens.border,
    input: 2,
  },
} satisfies TTokensOverride;

export function App() {
  return <ARCUI tokens={tokens}>{/* application */}</ARCUI>;
}

See Tokens and Theming.

Try it live

Use the existing Snack to explore ownership, presets, states, clear behavior, icons, loading, and native props.

Open Input in Expo Snack ↗

On this page