Field — dir/ui
Associate an input with its label, description, and validation error.
# Field
Associate an input with its label, description, and validation error.
## Install
```sh
npx shadcn@4.21.0 add lr-run/dir-ui/field#v0.1.2
```
[Registry item with source and dependencies](https://github.com/lr-run/dir-ui/blob/v0.1.2/registry.json)
Requires React 19, Tailwind CSS 4 and shadcn initialized with Base UI. Registry target placeholders resolve through components.json: @ui, @components, @hooks and @lib. Imports below use the conventional @/ prefix for illustration; the CLI rewrites them to your configured aliases. Shared components are installed once through registryDependencies. Theme CSS is imported by the UI modules. Existing files are never forcibly overwritten; review CLI conflicts before accepting changes. No Dir runtime is required.
## Field
```tsx
import { Field } from '@/components/ui/field.tsx'
```
| Prop | Type | Default / required | Notes |
| --- | --- | --- | --- |
| label | string | Required | |
| children | (props: FieldControlProps) => ReactNode | Required | |
| description / error | string | — | |
| required | boolean | false | |
```ts
type FieldControlProps = { id: string; "aria-describedby"?: string; "aria-required"?: boolean; invalid: boolean }
```
Spread the supplied id, aria-describedby, and invalid props onto the input. The caller owns values and validation.