Search documentation

Search pages, components, blocks, styles and colours.

Get started
Skip to content

Input

PreviousNext

A text input component for forms and user data entry with built-in styling and accessibility features.

Input on iOS

Installation

bunx --bun fabricator-ui@latest add input

Usage

import { Input } from "@/components/ui/input"
<Input
  placeholder="Email"
  keyboardType="email-address"
  autoCapitalize="none"
/>

Examples

input-example.tsx
 
import { Input } from "@/components/ui/input"
 
function InputExample() {
  return (
    <ExampleWrapper fit>
      <Example title="Default">
        <Input
          placeholder="Email"
          keyboardType="email-address"
          autoCapitalize="none"
        />
      </Example>
      <Example title="With a value">
        <Input defaultValue="gabs@fabricator.dev" />
      </Example>
      <Example title="Invalid">
        <Input aria-invalid defaultValue="not an email" />
      </Example>
      <Example title="Disabled">
        <Input
          editable={false}
          defaultValue="Read only"
          className="opacity-50"
        />
      </Example>
    </ExampleWrapper>
  )
}
 
export { InputExample }

API reference

Props it adds to what it wraps: "aria-invalid", disabled.

Differences from web

Same. onChangeText is the usual way to read a value, as with any TextInput.

Accessibility

Text is read as it appears. Give a control with no text an accessibilityLabel.