# Form Inputs > Components that collect input from the visitor: Form, Input, Textarea, Select, DatePicker, Checkbox and RadioGroup ## Common Form Input Props `Input`, `Textarea`, `Select`, `DatePicker`, `Checkbox` and `RadioGroup` share these props. | Prop | Type | Default | Description | | - | - | - | - | | `name` | string | — | The field's name. Its current value is stored in the Widget's data under this name. | | `required` | boolean | `false` | The form can't be submitted while the field is empty. | | `disabled` | boolean | `false` | Greys the field out and blocks input. | | `onChangeAction` | action | — | Function to run each time the value changes. | | `ariaLabel` | string | the field's `name` | Name read by screen readers when no visible label is linked to the field. | > [!NOTE] > > A field's `name` works as a variable. `` keeps whatever the visitor types in `email`, which you can show with `{email}` in the code, send with `{{email}}` in a [function](/docs/developer-guides/widgets/functions#template-tokens), or check in a [state](/docs/developer-guides/widgets/states) condition. Add the same field to the Widget's [schema](/docs/developer-guides/widgets/code-editor#schema) so its type is known. > [!TIP] > > Give every field in a `Form` its own `name`. Two fields with the same name write to the same value. ## Form Groups fields and runs one function when the visitor submits them. Put a `Button` with `submit` inside to submit the form. ```jsx
``` ### Props `Form` accepts all [common layout props](/docs/developer-guides/widgets/components/layout#common-layout-props), plus: | Prop | Type | Default | Description | | - | - | - | - | | `direction` | `row` \| `col` | `col` | Direction of the form's children. | | `onSubmitAction` | action | — | Function to run on submit. Every field's value is saved under its `name` first, so the function can use them all. | The browser checks the fields before `onSubmitAction` runs. A field that is `required` and empty, or that doesn't match its `pattern` or its `inputType` (an invalid email address, for example), stops the submit and the browser points to it. A `Button` with its own `onClickAction` and no `submit` runs its function without these checks. > [!TIP] > > A [Card](/docs/developer-guides/widgets/components/layout#card) with `asForm` works the same way, with its `confirm` button as the submit button. ## Input A single-line text field for short answers such as an email address, a name or an order number. ```jsx ``` ### Props In addition to the [common props](#common-form-input-props), `Input` accepts: | Prop | Type | Default | Description | | - | - | - | - | | `inputType` | `text` \| `email` \| `password` \| `number` \| `tel` \| `url` | `text` | Kind of value. It sets the keyboard on phones and the browser's format check. | | `placeholder` | string | — | Hint shown while the field is empty. | | `defaultValue` | string | — | Starting value. | | `value` | string | — | Value bound to the Widget's data. | | `pattern` | string | — | A regular expression the value must match. | | `variant` | `outline` \| `soft` | `outline` | `outline` draws a border; `soft` uses a tinted fill. | | `size` | `3xs` \| `2xs` \| `xs` \| `sm` \| `md` \| `lg` \| `xl` \| `2xl` \| `3xl` | `md` | Field height, from 22 px (`3xs`) to 48 px (`3xl`). `md` is 32 px. | | `gutterSize` | `2xs` \| `xs` \| `sm` \| `md` \| `lg` \| `xl` | matches `size` | Inner horizontal padding, from 6 px to 16 px. | | `pill` | boolean | `false` | Fully rounded ends. | | `autoFocus` | boolean | `false` | Puts the cursor in the field when the Widget appears. | | `autoSelect` | boolean | `false` | Selects the field's text when it gets focus. | | `allowAutofillExtensions` | boolean | `false` (`true` for `password`) | Lets password managers and autofill extensions fill the field. | ## Textarea A multi-line field for longer answers, such as a message or a reason. ```jsx ``` ### Props In addition to the [common props](#common-form-input-props), `Textarea` accepts: | Prop | Type | Default | Description | | - | - | - | - | | `placeholder` | string | — | Hint shown while the field is empty. | | `defaultValue` | string | — | Starting value. | | `value` | string | — | Value bound to the Widget's data. | | `rows` | number | `3` | Visible lines. | | `autoResize` | boolean | `false` | Grows with the text instead of showing a resize handle. | | `maxRows` | number | `10` | With `autoResize`, the most lines it grows to before scrolling. | | `variant` | `outline` \| `soft` | `outline` | Visual style. | | `size` | `3xs` \| `2xs` \| `xs` \| `sm` \| `md` \| `lg` \| `xl` \| `2xl` \| `3xl` | `md` | Size. | | `gutterSize` | `2xs` \| `xs` \| `sm` \| `md` \| `lg` \| `xl` | matches `size` | Inner horizontal padding. | | `autoFocus` | boolean | `false` | Puts the cursor in the field when the Widget appears. | | `autoSelect` | boolean | `false` | Selects the text when the field gets focus. | | `allowAutofillExtensions` | boolean | `false` | Lets autofill extensions fill the field. | ## Select A dropdown for choosing one option, with optional search and a clear button. ```jsx ``` ### Props In addition to the [common props](#common-form-input-props), `Select` accepts: | Prop | Type | Default | Description | | - | - | - | - | | `options` | `{label, value, disabled?, description?}[]` | — | The choices. `label` is the text shown, or `{text, color?, weight?}` to style it; `value` is what's stored. | | `placeholder` | string | `Select` | Shown while nothing is chosen. | | `defaultValue` | string | — | The option chosen at the start. | | `value` | string | — | Value bound to the Widget's data. | | `variant` | `outline` \| `soft` \| `ghost` | `outline` | `ghost` has no border or fill until hovered. | | `size` | `3xs` \| `2xs` \| `xs` \| `sm` \| `md` \| `lg` \| `xl` \| `2xl` \| `3xl` | `md` | Size. | | `width` | number \| string | — | Fixed width. | | `block` | boolean | `false` | Stretches to the full width of its container. | | `pill` | boolean | `false` | Fully rounded ends. | | `clearable` | boolean | `false` | Adds a button that clears the choice. | | `searchable` | boolean | `false` | Adds a search box that filters the options. | | `searchPlaceholder` | string | `Search...` | Hint in the search box. | | `searchEmptyMessage` | string | `No results found.` | Shown when the search matches nothing. | > [!NOTE] > > `description` adds a smaller line of helper text under an option's label, and `disabled` greys the option out so it can't be chosen. ## DatePicker A date field that opens a calendar. ```jsx