# Field
A wrapper component for form inputs with labels and validation.
## Installation
Start from a Svelte 5 application, then install the component package, shared theme, and Bits UI peer:
```bash
pnpm add coss-svelte @coss-svelte/theme bits-ui
```
Import `@coss-svelte/theme/style-coss.css` after Tailwind from the application's global stylesheet.
## Usage
```svelte
NameVisible on your profile
```
## Anatomy
- `Field`
- `FieldDescription`
- `FieldError`
- `FieldLabel`
- `FieldValidity`
## API Reference
### Field
A wrapper component for form inputs with labels and validation.
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `id` | `string` | - | ID forwarded to the form control. |
| `label` | `string` | `""` | Accessible label or fallback visible label for the control. |
| `description` | `string` | `""` | Supporting text rendered by the component's built-in fallback layout. |
| `error` | `string` | `""` | Validation message rendered by the field fallback layout. |
| `required` | `boolean` | `false` | Marks the field or label as required. |
| `disabled` | `boolean` | `false` | Disables interaction with the control. |
| `invalid` | `boolean` | `false` | Marks the component invalid independently of parse validity. |
**Composition and refs**
- `children: Snippet<[]>`
Inherits from [Svelte
attributes](https://svelte.dev/docs/svelte/basic-markup#Attributes).
### FieldDescription
Provides supporting copy for the parent component.
**Composition and refs**
- `children: Snippet<[]>`
Inherits from [Svelte component attributes](https://svelte.dev/docs/svelte/basic-markup#Attributes).
### FieldError
Renders validation or error feedback for the parent field.
**Composition and refs**
- `children: Snippet<[]>`
Inherits from [Svelte
attributes](https://svelte.dev/docs/svelte/basic-markup#Attributes).
### FieldLabel
Labels the parent component or a grouped section.
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `required` | `boolean` | `false` | Marks the field or label as required. |
| `for` | `string` | - | Configures the for behavior for this component. |
**Composition and refs**
- `children: Snippet<[]>`
Inherits from [Svelte