Skip to main content

Input

Text input field with label, icons, validation, and clear button support.

Basic Usage

import { Input } from '@multinaire/ui';

<Input
placeholder="Enter text"
value={value}
onChangeText={setValue}
/>

Props

PropTypeDefaultDescription
placeholderstringPlaceholder text shown when the field is empty
valuestringCurrent value of the input
titlestringField label displayed above the input
requiredbooleanfalseMark the field as required. Displays a visual indicator
allowClearbooleanfalseShow a clear (×) button to reset the value
leadingIconName | ReactElementLeading icon name or a custom React element rendered at the start of the input
trailingIconName | ReactElementTrailing icon name or a custom React element rendered at the end of the input
extraReactElementExtra element rendered at the trailing end of the label row (e.g. a "Forgot password?" link)
errorTextstringError message displayed below the input
multilinebooleanfalseEnable multi-line text input
keyboardTypeKeyboardTypeOptionsKeyboard type shown when the input is focused
flexnumberFlex grow value
marginSpacingPropsOuter margin
testIDstringTest identifier for UI automation
onChangeText(text: string) => voidCallback invoked on every text change
onSubmit(text: string) => voidCallback invoked when the user submits the input (e.g. presses Enter)

Examples

With Label

<Input
title="Email"
placeholder="Enter your email"
value={email}
onChangeText={setEmail}
keyboardType="email-address"
/>

Required Field

<Input
title="Username"
required
placeholder="Enter username"
value={username}
onChangeText={setUsername}
/>

With Icons

<Input
leading="Search"
placeholder="Search..."
value={search}
onChangeText={setSearch}
/>

<Input
leading="Lock"
trailing="Eye"
placeholder="Password"
value={password}
onChangeText={setPassword}
/>

With Clear Button

<Input
allowClear
placeholder="Search..."
value={search}
onChangeText={setSearch}
/>

With Error

<Input
title="Email"
placeholder="Enter email"
value={email}
onChangeText={setEmail}
errorText={emailError}
/>

Multiline

<Input
title="Description"
placeholder="Enter description..."
multiline
value={description}
onChangeText={setDescription}
/>