Field
Form field wrapper with label, description, and error
Start Here
Start from the smallest working snippet, then move to interactive examples and the full API contract below.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
<script lang="ts">
import '@dryui/ui/themes/default.css';
import '@dryui/ui/themes/dark.css';
import { Field } from '@dryui/ui';
</script>
<Field.Root>
<Label>Username</Label>
<Input bind:value={username} />
</Field.Root>Import options
Root package
import { Field } from '@dryui/ui'Per-component subpath
import { Field } from '@dryui/ui/field'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Field with label and description
Must be at least 3 characters.
<Field.Root>
<Label for="username">Username</Label>
<Input id="username" placeholder="Enter username" />
<Field.Description>Must be at least 3 characters.</Field.Description>
</Field.Root>Field with error state
This field is required
<Field.Root error="This field is required">
<Label for="email">Email</Label>
<Input id="email" placeholder="[email protected]" />
<Field.Error>This field is required</Field.Error>
</Field.Root>Required field
<Field.Root required>
<Label for="name">Full name</Label>
<Input id="name" placeholder="John Doe" />
</Field.Root>Structure
Compound components always start with Field.Root. Use this structure block to understand required wrappers before you wire state or styling.
Field.Root
Compose
The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.
Compound component. Start with Field.Root, then add only the parts you need.
Field.Root
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
error | string | — | — | — |
required | boolean | — | — | — |
disabled | boolean | — | — | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Field.Description
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <p> attributes via rest props. Common examples: id, style, aria-describedby.
Field.Error
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <p> attributes via rest props. Common examples: id, style, aria-describedby.