--- title: Field description: Fields wrap a single form control with label, description, and error messaging in a consistent layout. category: Forms --- import { meta as FieldMeta, Default } from '@/content/stories/field'; import Canvas from '@/components/component-docs/canvas'; import Demo from '@/components/component-docs/demo'; export const config = { dependencies: { components: [Canvas, Demo], scripts: [ '../../components/component-docs/demo.script.tsx', '../../components/component-docs/canvas.script.tsx', '../../components/component-docs/controls.script.tsx', ], }, }; # Field

Fields wrap a single form control with label, description, and error messaging in a consistent layout.

## Try it ## Usage Set `name` on `RuiField` to register with `RuiForm` and to copy onto the listed control. Place a Radiant control (`RuiInput`, `RuiSelect`, `RuiSwitch`, …) as the child; Field discovers controls via `data-rui-control` and known host tags, not bare `` elements. Use `RuiFieldDescription` and `RuiFieldError` for helper and error text. ```tsx import { RuiField, RuiFieldDescription, RuiFieldError } from '@ecopages/radiant-ui/field'; import { RuiLabel } from '@ecopages/radiant-ui/label'; import { RuiInput } from '@ecopages/radiant-ui/input'; Email We will never share your email. ``` ## Custom markup `` coordinates any light-DOM tree that matches its query contract. The `RuiField` helper stamps `[data-ref="field"]`; it is not required. ```tsx import '@ecopages/radiant-ui/field'; import '@ecopages/radiant-ui/input';

We will never share your email.

``` The field wires `aria-describedby`, `aria-invalid`, and error text on the control. Use a library control host or `[data-rui-control]` — bare native inputs without the marker are ignored. Set `name` on the field (or on a form-associated host) so a native `
` can submit. `RuiInput` / `RuiTextarea` / checkbox / switch / radio / checkbox-group / radio-group submit through their inner input. `rui-date-input`, `rui-number-field`, `rui-slider`, and `rui-knob` submit through `name` on the host. `RuiDateField` is not listed; it copies `name` onto the nested `rui-date-input`. `RuiDateRangePicker` is not listed; `start-name` / `end-name` land on the nested `rui-date-input` hosts. `RuiSelect` and similar hosts are not form-associated; their values are available to `RuiForm` `onSubmit`, not to `new FormData(form)`. ## Use Radiant controls

`RuiField` only wires library controls: presentational ones marked with `data-rui-control` (`RuiInput`, `RuiTextarea`, select triggers) and host elements such as `rui-select`, `rui-switch`, and `rui-date-input`. An embedded `rui-listbox` is the parent select or combobox's option surface, not a separate field control. Bare `` / `