# Input

- **Section:** Components
- **URL:** https://refast.fastapicloud.dev/docs/components/input
- **Markdown:** https://refast.fastapicloud.dev/docs/components/input.md
- **Source:** https://github.com/idling-mind/refast-docs/blob/main/docs/pages/components/form_inputs/input.py
- **Live examples:** the widgets on this page need a browser; open the URL above to try them.
- **Applies to:** refast 0.12.2

A single-line text input with optional label, description, placeholder, validation, and event callbacks.

```python
from refast.components import Input

Input(name="username", placeholder="Enter username")
Input(
    name="email",
    label="Email Address",
    description="We'll never share your email.",
    type="email",
    required=True,
    error="Please enter a valid email",
    on_change=ctx.callback(handle_change),
)
```

```python
Input(
    name="demo",
    label="Demo Input",
    placeholder="Enter text…",
    type="text",
    disabled=False,
    required=False,
    error=None,
)
```

## Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `name` | `str \| None` | `None` | HTML name attribute |
| `label` | `str \| None` | `None` | Label text |
| `description` | `str \| None` | `None` | Help text below label |
| `type` | `"text" \| "email" \| "password" \| "number" \| "tel" \| "url" \| "search"` | `"text"` | Input type |
| `placeholder` | `str` | `""` | Placeholder text |
| `value` | `str \| None` | `None` | Controlled value |
| `default_value` | `str \| None` | `None` | Uncontrolled initial value |
| `required` | `bool` | `False` | Shows required asterisk |
| `disabled` | `bool` | `False` | Disables interaction |
| `read_only` | `bool` | `False` | Read-only mode |
| `error` | `str \| None` | `None` | Error message |
| `debounce` | `int` | `0` | Delay in ms before `on_change` fires |
| `on_change` | `Callback \| None` | `None` | Fired on value change |
| `on_blur` | `Callback \| None` | `None` | Fired on blur |
| `on_focus` | `Callback \| None` | `None` | Fired on focus |
| `on_keydown` | `Callback \| None` | `None` | Fired on key-down |
| `on_keyup` | `Callback \| None` | `None` | Fired on key-up |
| `on_input` | `Callback \| None` | `None` | Fired on every input event |
| `class_name` | `str` | `""` | Extra Tailwind classes |

---

Part of the Refast documentation: [all pages](https://refast.fastapicloud.dev/llms.txt), [everything on one page](https://refast.fastapicloud.dev/llms-full.txt), [search](https://refast.fastapicloud.dev/api/search?q=save_prop).
