# Field (@limerdev/zest) A form field: `Field` holds a `Field.Label`, one control (`Input` …) and an optional `Field.Description` and `Field.Error`. It wires them for you: the label points at the control, the description and a shown error describe it, and a shown error (or `invalid`) marks it `aria-invalid`. `disabled` disables the control. `Field.Set` with a `Field.Legend` groups related fields; `Field.Group` stacks fields; `orientation` puts the label beside the control. - Category: Data input - Import: `import { Field } from '@limerdev/zest'` - Exports: `Field.Root`, `Field.Set`, `Field.Legend`, `Field.Group`, `Field.Content`, `Field.Label`, `Field.Title`, `Field.Description`, `Field.Error` - Use for: Every labelled form control, so labels, help text and errors are announced with it. - Don't: Setting `id`, `for`, `aria-describedby` or `aria-invalid` by hand inside a Field: it does that. More than one control in a `Field`: use one Field per control, in a `Field.Group`. Error text in a `Field.Description`: use `Field.Error`. ```svelte Project Name Shown in the sidebar and in emails. ``` Props of `Field.Root`: - `disabled` (`boolean`, default `false`): Disable the control and dim the field. - `invalid` (`boolean`, default `false`): Mark the control invalid without an error message (a shown `Field.Error` does it too). - `orientation` (`"horizontal" | "vertical" | "responsive"`, default `'vertical'`): Where the label goes: above the control (`vertical`), beside it (`horizontal`), or beside it when the field group is wide enough (`responsive`). Props of `Field.Legend`: - `variant` (`"legend" | "label"`, default `'legend'`): `legend` for a section heading, `label` for a legend that names a group of choices like a label. Props of `Field.Error`: - `errors` (`FieldErrorItem[]`): Validation errors, as form libraries return them; their messages are listed. Example: Label description and error The Field wires its label, description and error to the control: leave the field to see the error appear and the input turn invalid. ```svelte Project name (touched = true)} placeholder="Zest" /> Shown in the sidebar and in emails. ``` Example: Several errors and disabled Several errors show as a list. disabled on the Field disables its control. ```svelte
Password Customer number Set when the customer is created.
``` Example: A form Field.Set and Field.Legend group related fields. responsive puts labels in a column beside their controls when there is room; horizontal puts a label beside its control. ```svelte
event.preventDefault()}> Billing Where invoices are sent. Company Invoice email VAT number Leave empty outside the EU.
```