For AI agents: the complete documentation index is available at https://a3s-lab.github.io/UI/v0.4.0/en/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/UI/v0.4.0/en/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/UI/v0.4.0/en/components/field.md.
Field keeps one control's persistent label, requirement, description, and local error in one coherent input unit. It does not add a second interaction model or an unnecessary accessibility group.
Use one ordinary <div class="field"> for one control. The native control keeps focus, editing, validation, and form behavior; Field owns only the relationships around it.
<div class="field"> <label for="workspace-name">Workspace display name</label> <input id="workspace-name" name="workspaceName" dir="auto" aria-describedby="workspace-name-help" required /> <p id="workspace-name-help" data-field-description> Shown in navigation and invitations. </p> <p id="workspace-name-error" data-field-message role="alert" hidden> Enter a workspace name. </p></div>
Do not add role="group" to a single Field. It does not improve the control's name or description and adds an unnamed group to the accessibility tree. When several controls form one question, use native <fieldset> and <legend>.
Empty and populated are neutral value states. Invalid begins only after validation has run. Disabled and read-only are different availability contracts and must not be reduced to one faded visual treatment.
Disabled removes a control from focus and form submission. Read-only preserves focus, selection, copying, and form submission. Both states retain their value and explain why editing is unavailable.
Availability semantics
<form class="grid w-full gap-5" data-field-availability="en">
<div class="field" data-disabled="true">
<label for="field-disabled-slug-en">Archived workspace slug</label>
<input
id="field-disabled-slug-en"
name="archivedSlug"
value="legacy-runtime"
aria-describedby="field-disabled-slug-reason-en"
disabled
/>
<p id="field-disabled-slug-reason-en" data-field-description>
Archived identifiers remain visible for audit history and cannot be
submitted.
</p>
</div>
<div class="field" data-readonly="true">
<label for="field-readonly-owner-en">Organization owner</label>
<input
id="field-readonly-owner-en"
name="organizationOwner"
value="owner@example.com"
aria-describedby="field-readonly-owner-reason-en"
readonly
/>
<p id="field-readonly-owner-reason-en" data-field-description>
This value remains selectable and submitted; only an organization
transfer can change it.
</p>
</div>
</form>
Use one native Fieldset when several controls answer one question. Each child remains an ordinary Field with one control; no unnamed role="group" wrappers are needed.
Use one persistent visible label and connect it with for and id. Placeholder text is never the only name.
Keep ordinary guidance in aria-describedby. Append the visible error ID after failed validation and remove it after recovery or reset.
Keep an invalid Field's attempted value, focus the actionable control, name the problem, and give a concrete correction. Color alone is insufficient.
Do not put role="group" on a single Field. Use <fieldset> and <legend> only when multiple controls form one question.
Use disabled only when the value must leave focus and submission. Use readonly when users still need to inspect, select, copy, or submit the value.
Use dir="auto" for user-authored free text whose direction is not known ahead of time. Keep machine-oriented values in their authored direction.
Do not validate, trim, or submit while an IME composition is active. Wait until composition ends.
Verify long localized labels and errors, 390px layouts, 200% zoom, dark mode, RTL, forced colors, coarse pointers, and screen-reader/browser combinations before release.
Field does not own domain validation, server responses, authorization, persistence, submission, or error-summary focus. Form and the host application coordinate those concerns while preserving Field's local relationships.