Appica UIUI 1.0.0

Field

A wrapper that pairs a form control with its label, description, and validation messages.

We'll never share your email.

Usage

Field wires a label, description, and error message to one control without you having to juggle id/htmlFor/aria-describedby by hand. Drop any Appica form control inside it — Input, Textarea, NumberField, Select, Switch, and the rest are all Field-aware: they pick up the field's disabled and invalid state and contribute their value to validation.

Validation is built in. Give Field a validate function (or use the native constraints on the control) and render a FieldError to surface the message — no separate state needed. Use Fieldset to gather several related fields under a single legend, and to disable the whole group at once.

Examples

Default

A label sits above the control and a description below it. Field associates all three automatically — clicking the label focuses the control, and the description is announced as the control's aria-describedby.

Validation

Pass a validate callback that returns an error string (or an array of them) when the value is invalid, or null when it's fine. validationMode decides when it runs — onBlur here, or onChange / onSubmit. The returned message renders inside FieldError, and the control flips to its error styling via the field's invalid state.

Disabled & read-only

Set disabled on the Field to disable the whole thing at once — it greys the control and takes it out of the tab order, propagating down to whatever control is inside. readOnly is a control-level concern (there's no field-wide equivalent), so set it on the input: it stays focusable and selectable but can't be edited.

Fieldset

Fieldset groups related fields under a FieldsetLegend and renders a native <fieldset> / <legend>. Setting disabled on the fieldset disables every control inside it in one move.

RTL

Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your tree in DirectionProvider so direction-aware behavior — roving focus, popup placement, and the like — follows the same direction.

The label and description align to the start edge and the control follows the resolved direction. For setup details and caveats, see the RTL guide.

كما يظهر على بطاقة الهوية.

API reference

Field and Fieldset wrap Base UI's Field and Fieldset; every remaining prop is forwarded to the underlying element.

Field

The root that provides labelling and validation context to a single control. Renders a <div> and exposes data-valid / data-invalid / data-dirty / data-touched / data-filled / data-focused / data-disabled for styling.

FieldLabel

The control's label. Renders a <label> tied to the control, so clicking it moves focus.

FieldDescription

Supporting text for the control. Renders a <p> and is wired to the control's aria-describedby.

FieldError

The validation message. Renders only when the field is invalid (or match says so), with a height/opacity enter–exit transition that honours prefers-reduced-motion. With no children it shows the field's current error message; with match you supply custom children for a specific validity condition.

FieldValidity

A render-prop that exposes the field's live validity so you can render fully custom messaging.

Fieldset

Groups related fields. Renders a native <fieldset> (role="group") laid out as a column.

FieldsetLegend

The fieldset's heading. Renders a <legend> that names the group.

Accessibility

  • FieldLabel renders a real <label> bound to the control, so the label is both clickable and announced — no manual htmlFor/id wiring.
  • FieldDescription is linked through the control's aria-describedby, and FieldError is announced when it appears.
  • Fieldset renders a native <fieldset> with role="group" named by its <legend>; disabled on it disables every descendant control.
  • The error message's enter–exit transition honours prefers-reduced-motion.
  • To label a group of controls (a RadioGroup, ToggleGroup, or a DateField/TimeField segment group) rather than a single input, don't use FieldLabel — a <label for> doesn't associate with a role="group". Name those with aria-labelledby pointing at a heading instead.

© 2026 Appica UI. A free component library, crafted by the Appica team.