---
title: "Input"
description: "A one-line field for text, email, number, password, URL, phone or date."
---

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

# Input

```gistui
root = Form("profile", Grid(Input("name", "Full name", placeholder:"Ada Lovelace", required), Input("site", "Website", type:url, protocols:["https"], hint:"Must start with https://"), Input("seats", "Seats", type:number, min:1, max:100, value:"5"), Input("phone", "Phone", type:tel), cols:2))
```

## Signature

This is the line a model reads in the system prompt.

```gistui
Input(name, label, type:text|email|number|password|url|tel|date, placeholder:str, value:str, min:num, max:num, minLength:num, maxLength:num, pattern:str, match:str, protocols:[str], error:str, bind:$var, size:Size, hint:str, required)
```

- **Group:** Forms
- **Children:** No
- **Positional arguments:** `name`, `label` (a trailing `?` means it may be left out)

## Props

| Prop | Type | How to write it | Notes |
|---|---|---|---|
| `name` | string | positional, required |  |
| `label` | string | positional, required |  |
| `type` | `text` · `email` · `number` · `password` · `url` · `tel` · `date` | named: `type:…` | Default `"text"`. |
| `placeholder` | string | named: `placeholder:…` |  |
| `value` | string | named: `value:…` | initial value |
| `min` | number | named: `min:…` |  |
| `max` | number | named: `max:…` |  |
| `minLength` | number | named: `minLength:…` |  |
| `maxLength` | number | named: `maxLength:…` |  |
| `pattern` | string | named: `pattern:…` | regex the value must match |
| `match` | string | named: `match:…` | name of a field it must equal |
| `protocols` | list of string | named: `protocols:…` | allowed URL protocols, default http/https |
| `error` | string | named: `error:…` | custom error message |
| `bind` | `$state` variable | `bind:$name` | two-way binding to a $variable |
| `size` | `sm` · `md` · `lg` | named: `size:…` | Also accepts `small`, `medium`, `large`. |
| `hint` | string | named: `hint:…` | help text under the field |
| `required` | flag | bare word: `required` |  |

## Use your own component

Keep the name and schema, swap what is drawn. The prompt and the model's output do not change.

### React

```tsx
import { ui } from "@gistui/react/ui";

const lib = ui.extend({ Input: MyInput });
<GistUI library={lib} stream={response.body} />;
```
### Vue

```vue
<GistUI :source="answer" :components="{ Input: MyInput }" />
```
### Svelte

```svelte
<GistUI source={answer} components={{ Input: MyInput }} />
```
### Solid

```tsx
<GistUI source={answer()} components={{ Input: MyInput }} />
```
### Vanilla

```ts
import { ui } from "@gistui/vanilla/ui";

const lib = ui.extend({ Input: (ctx) => ({ el: myElement(ctx) }) });
```

See [Custom components](/docs/guides/custom-components/) for the full contract. Style hook: `[data-gistui="Input"]`.

Source: https://gistui.com/docs/components/forms/input/index.mdx
