> ## Documentation Index
> Fetch the complete documentation index at: https://prefab.prefect.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Input

> Text input fields for user data entry.

Inputs collect text, email, passwords, and other single-line data from users.

## Basic Usage

> [card]
>
> ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> from prefab_ui.components import Input
>
> Input(placeholder="Enter your email...")
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "name": "input_6",
>     "type": "Input",
>     "inputType": "text",
>     "placeholder": "Enter your email...",
>     "disabled": false,
>     "readOnly": false,
>     "required": false
>   }
> }
> ```

## Input Types

Different input types provide appropriate keyboards and validation on mobile devices:

> [card]
>
> ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> from prefab_ui.components import (
>     Input,
>     Column,
> )
>
> with Column(gap=4):
>     Input(input_type="email", placeholder="Email")
>     Input(input_type="password", placeholder="Password")
>     Input(input_type="number", placeholder="Age")
>     Input(input_type="tel", placeholder="Phone")
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "cssClass": "gap-4",
>     "type": "Column",
>     "children": [
>       {
>         "name": "input_7",
>         "type": "Input",
>         "inputType": "email",
>         "placeholder": "Email",
>         "disabled": false,
>         "readOnly": false,
>         "required": false
>       },
>       {
>         "name": "input_8",
>         "type": "Input",
>         "inputType": "password",
>         "placeholder": "Password",
>         "disabled": false,
>         "readOnly": false,
>         "required": false
>       },
>       {
>         "name": "input_9",
>         "type": "Input",
>         "inputType": "number",
>         "placeholder": "Age",
>         "disabled": false,
>         "readOnly": false,
>         "required": false
>       },
>       {
>         "name": "input_10",
>         "type": "Input",
>         "inputType": "tel",
>         "placeholder": "Phone",
>         "disabled": false,
>         "readOnly": false,
>         "required": false
>       }
>     ]
>   }
> }
> ```

## With Labels

Pair inputs with labels for accessible forms:

> [card]
>
> ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> from prefab_ui.components import (
>     Column,
>     Input,
>     Label,
> )
>
> with Column(gap=2):
>     Label("Email address")
>     Input(input_type="email", placeholder="you@example.com", required=True)
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "cssClass": "gap-2",
>     "type": "Column",
>     "children": [
>       {"type": "Label", "text": "Email address", "optional": false},
>       {
>         "name": "input_11",
>         "type": "Input",
>         "inputType": "email",
>         "placeholder": "you@example.com",
>         "disabled": false,
>         "readOnly": false,
>         "required": true
>       }
>     ]
>   }
> }
> ```

## Date & Time Inputs

Native date and time pickers use the browser's built-in UI:

> [card]
>
> ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> from prefab_ui.components import (
>     Column,
>     Input,
>     Label,
>     Row,
> )
>
> with Row(gap=4):
>     with Column(gap=2, css_class="flex-1"):
>         Label("Date")
>         Input(input_type="date", name="date")
>     with Column(gap=2, css_class="flex-1"):
>         Label("Time")
>         Input(input_type="time", name="time")
>     with Column(gap=2, css_class="flex-1"):
>         Label("Date & Time")
>         Input(input_type="datetime-local", name="datetime")
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "cssClass": "gap-4",
>     "type": "Row",
>     "children": [
>       {
>         "cssClass": "gap-2 flex-1",
>         "type": "Column",
>         "children": [
>           {"type": "Label", "text": "Date", "optional": false},
>           {
>             "name": "date",
>             "type": "Input",
>             "inputType": "date",
>             "disabled": false,
>             "readOnly": false,
>             "required": false
>           }
>         ]
>       },
>       {
>         "cssClass": "gap-2 flex-1",
>         "type": "Column",
>         "children": [
>           {"type": "Label", "text": "Time", "optional": false},
>           {
>             "name": "time",
>             "type": "Input",
>             "inputType": "time",
>             "disabled": false,
>             "readOnly": false,
>             "required": false
>           }
>         ]
>       },
>       {
>         "cssClass": "gap-2 flex-1",
>         "type": "Column",
>         "children": [
>           {"type": "Label", "text": "Date & Time", "optional": false},
>           {
>             "name": "datetime",
>             "type": "Input",
>             "inputType": "datetime-local",
>             "disabled": false,
>             "readOnly": false,
>             "required": false
>           }
>         ]
>       }
>     ]
>   }
> }
> ```

## Disabled State

> [card]
>
> ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> from prefab_ui.components import Input
>
> Input(placeholder="Disabled input", disabled=True)
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "name": "input_12",
>     "type": "Input",
>     "inputType": "text",
>     "placeholder": "Disabled input",
>     "disabled": true,
>     "readOnly": false,
>     "required": false
>   }
> }
> ```

## Read-Only

A read-only input displays its value and allows users to select and copy the text, but prevents editing. Unlike `disabled`, the input retains its normal visual appearance -- it doesn't grey out or signal that interaction is blocked.

> [card]
>
> ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> from prefab_ui.components import Input
>
> Input(value="api_key_91x8z3...", read_only=True)
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "name": "input_13",
>     "value": "api_key_91x8z3...",
>     "type": "Input",
>     "inputType": "text",
>     "disabled": false,
>     "readOnly": true,
>     "required": false
>   },
>   "state": {"input_13": "api_key_91x8z3..."}
> }
> ```

## Reading the Value

Use `.rx` to get a reactive reference to the input's current text. As the user types, any component that references `.rx` updates automatically:

> [card]
>
> ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> from prefab_ui.components import Column, Input, Text
>
> with Column(gap=4):
>     inp = Input(placeholder="What is your name, traveler?")
>     Text(f"Hello, {inp.rx.default('stranger')}!")
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "cssClass": "gap-4",
>     "type": "Column",
>     "children": [
>       {
>         "name": "input_14",
>         "type": "Input",
>         "inputType": "text",
>         "placeholder": "What is your name, traveler?",
>         "disabled": false,
>         "readOnly": false,
>         "required": false
>       },
>       {"content": "Hello, {{ input_14 | default:stranger }}!", "type": "Text"}
>     ]
>   }
> }
> ```

Type a name and the greeting updates with each keystroke.

## API Reference

> [card] Input Parameters
>
> **input\_type** `str` (default: text)
>
> Input type: `"text"`, `"email"`, `"password"`, `"number"`, `"tel"`, `"url"`, `"search"`, `"date"`, `"time"`, `"datetime-local"`, `"file"`.
>
> **placeholder** `str | None` (default: None)
>
> Placeholder text shown when the input is empty.
>
> **value** `str | None` (default: None)
>
> Initial value.
>
> **name** `str | None` (default: None)
>
> State key for the input's current value. Auto-generated if not provided. Set this to bind the input to a known key, or use `.rx` to reference the auto-generated key without knowing it.
>
> **disabled** `bool` (default: False)
>
> Whether the input is non-interactive.
>
> **read\_only** `bool` (default: False)
>
> Whether the input is read-only. The value is visible and selectable but cannot be edited.
>
> **required** `bool` (default: False)
>
> Whether the input is required for form submission.
>
> **css\_class** `str | None` (default: None)
>
> Additional Tailwind CSS classes appended to the component's built-in styles.

## Protocol Reference

```json Input theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
{
  "type": "Input",
  "id?": "string",
  "onMount?": "any",
  "name?": "string",
  "value?": "string",
  "inputType?": "text | email | password | number | tel | url | search | date | time | datetime-local | file",
  "placeholder?": "string",
  "disabled?": false,
  "readOnly?": false,
  "required?": false,
  "minLength?": "number",
  "maxLength?": "number",
  "min?": "number",
  "max?": "number",
  "step?": "number",
  "pattern?": "string",
  "onChange?": "Action | Action[]",
  "cssClass?": "string"
}
```

For the complete protocol schema, see [Input](https://prefab.prefect.io/docs/protocol/input.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.