Glin UI
Primitive / Moleculebeta

Field

Accessible form field layout that wires labels, descriptions and errors to a control.

Edit on GitHub

Checkout

Studio keyboard, 75%. $129.00 with free shipping.

Contact

We send the receipt and tracking here.

Shipping
Payment

Installation

Install from
pnpm dlx @glinui/cli@latest add field

Prefer the package?

Usage

FieldControl wires one child control to its Field. It clones the child and injects the generated id (matching the label htmlFor), aria-describedby pointing at the description and error, aria-invalid when an error is present and aria-required. Put exactly one control inside it.

Unlike shadcn Field, which leaves id and aria wiring to you, Glin UI Field does it through FieldControl, so labels, hints and errors stay connected without manual ids. Controls rendered outside FieldControl are not wired.

Label, description, error

We never share your email.

import { Field, FieldControl, FieldDescription, FieldError, FieldLabel } from "@glinui/ui"
import { Input } from "@glinui/ui"
export function Demo() {
return (
<Field>
<FieldLabel>Email</FieldLabel>
<FieldControl><Input type="email" placeholder="name@example.com" /></FieldControl>
<FieldDescription>We never share your email.</FieldDescription>
<FieldError>Enter a valid email address.</FieldError>
</Field>
)
}

Invalid

import { Field, FieldControl, FieldError, FieldLabel } from "@glinui/ui"
import { Input } from "@glinui/ui"
export function Demo() {
return (
<Field invalid>
<FieldLabel>Username</FieldLabel>
<FieldControl><Input defaultValue="a" /></FieldControl>
<FieldError errors={[{ message: "At least 3 characters" }]} />
</Field>
)
}

Accessibility

  • Each Field generates ids so the label `htmlFor`, description and error are wired automatically via FieldControl.
  • FieldError uses `role="alert"` so errors are announced.
  • `aria-describedby` only lists parts that are rendered.
  • FieldSet and FieldLegend use native fieldset and legend semantics.

Keyboard Interactions

KeyAction
TabMoves through controls; clicking a label focuses its control.

ARIA Attributes

  • `aria-describedby` with description and error ids
  • `aria-invalid` when invalid or an error is rendered
  • `role="alert"` on errors

Reduced Motion

Field is layout only and has no motion of its own.

API Reference

Field

PropTypeRequiredDefaultDescription
orientation"vertical" | "horizontal" | "responsive"-verticalLabel and control layout. Responsive stacks on small screens.
invalidboolean-falseMarks the control aria-invalid and tints the label.
disabledboolean-falseDisables the control and dims the field.
errorsArray<{ message?: string } | undefined>No-Error objects (for example from a form library). Messages are de-duplicated.

FieldControl

PropTypeRequiredDefaultDescription
childrenReactElement--Single control. Receives the generated id, aria-describedby, aria-invalid and disabled.
errorsArray<{ message?: string } | undefined>No-Error objects (for example from a form library). Messages are de-duplicated.

FieldError

PropTypeRequiredDefaultDescription
errorsArray<{ message?: string } | undefined>No-Messages from a form library; duplicates collapse. Renders nothing when empty.

FieldLabel, FieldDescription, FieldContent, FieldTitle, FieldGroup, FieldSet, FieldLegend, FieldSeparator

PropTypeRequiredDefaultDescription
classNamestring--Layout and typography parts. FieldLegend takes variant legend or label.
errorsArray<{ message?: string } | undefined>No-Error objects (for example from a form library). Messages are de-duplicated.

Source

Import directly from the package or browse the source on GitHub. Click any file to view it.

Import

import { Field } from "@glinui/ui"

Source Files

Dependencies

@glinui/ui@radix-ui/react-slotclass-variance-authority

Generated API Snapshot

Beta

Auto-extracted from TypeScript source in packages/ui/src/components/field.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.

Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata

Primary Props Type

FieldProps

FieldErrorProps

PropTypeRequiredDefaultDescription
errorsArray<{ message?: string } | undefined>No-Error objects (for example from a form library). Messages are de-duplicated.

FieldLabelProps

No explicit fields extracted for this props type.

FieldLegendProps

PropTypeRequiredDefaultDescription
variant"legend" | "label"No"legend"-

FieldProps

PropTypeRequiredDefaultDescription
disabledbooleanNofalseMarks the field disabled.
invalidbooleanNofalseMarks the field invalid and wires aria-invalid onto its control.
orientation"vertical" | "horizontal" | "responsive"No"vertical"Variant option from fieldVariants.