For AI agents: the complete documentation index is available at https://a3s-lab.github.io/UI/en/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/UI/en/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/UI/en/components/field.md.

Field

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.

Workspace display name

Shown in navigation, invitations, and audit history. Use 2 to 40 characters.

Usage

Import Tailwind and one complete A3S UI style bundle:

@import "tailwindcss";
@import "@a3s-lab/ui/a3s.css";

For component-level loading, import the base styles, Field structure, the control structure you use, and one visual style in that order:

@import "@a3s-lab/ui/base.css";
@import "@a3s-lab/ui/components/field.css";
@import "@a3s-lab/ui/components/input.css";
@import "@a3s-lab/ui/styles/a3s.css";

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>.

Parameters

ContractPurpose
.fieldStructural root for exactly one control and its supporting relationships
<label for>Persistent visible name; for must match the control id
required or visible optional copyCommunicates whether omission is allowed; decoration alone is insufficient
data-field-descriptionPersistent guidance associated through aria-describedby
data-field-messageCurrent local error; reveal only after validation and associate it while visible
data-invalid="true"Visual state on Field after validation has failed
data-disabled="true"Visual availability state paired with native disabled on the control
data-readonly="true"Visual availability state paired with native readonly on a supported control
data-orientation="horizontal"Aligns one control with its label content when the relationship remains readable
data-orientation="responsive"Stacks first and changes to a horizontal arrangement in a wide Field container

States and variants

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.

Required and optional

State the requirement once, next to the label. Native required remains the machine-readable contract; visible copy helps users plan before submission.

Requirement clarity

Receives recovery and billing notices.

Visible only to workspace administrators.

Disabled and read-only

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

Archived identifiers remain visible for audit history and cannot be submitted.

This value remains selectable and submitted; only an organization transfer can change it.

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.

Related controls
Release window

Used to schedule the production handoff.

Responsive orientation

Use responsive orientation only when the label, explanation, and control remain one readable relationship. The semantic order never changes.

Responsive field

Enter the number of days completed task artifacts remain available.

RTL

Layout direction belongs on Field or an ancestor. Machine-oriented values such as email addresses and URLs keep their authored text direction.

RTL field

يُستخدم لإشعارات الاسترداد وإدارة مساحة العمل.

Accessibility

  • 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.