Field

Form field wrapper with label, description, error, and accessibility linking

import { Field } from "@plexui/ui/components/Field";

Examples

Overview

size
We'll never share your email with anyone else.

With description

We'll never share your email with anyone else.

With error message

Required

Sizing

size
We'll never share your email with anyone else.

Horizontal layout

orientation

Textarea

Write a short bio for your profile.

Select

Select your primary role.

Slider

Set your budget range ($200 – 800).

Fieldset

Address Information

We need your address to deliver your order.

Checkbox

Choose which notifications you'd like to receive.

Radio

Select your preferred plan.

Switch

Field group

Get notified when the assistant responds to requests that take time, like research or image generation.
Get notified when tasks you've created have updates.

Validation and Errors

Render prop pattern

For controls that need explicit prop wiring, pass a function as children. The function receives { id, "aria-describedby", "aria-invalid" } which you spread onto the control.

<Field label="Email" errorMessage="Email is required">
  {(fieldProps) => <Input {...fieldProps} placeholder="Enter email..." />}
</Field>

Optical alignment

opticallyAlign="start"
We'll never share your email.

Form example

Payment Method

All transactions are secure and encrypted


Billing Address

The billing address associated with your payment method

Reference

PropTypeDefaultDescription
labelReactNodeLabel text for the field
descriptionReactNodeHelper text below the label; linked via aria-describedby
errorMessageReactNodeError message below the control; auto-sets aria-invalid on child
size"3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl""md"Controls the label font size to match the child control
requiredbooleanfalseShows a required asterisk after the label (visual only)
orientation"vertical" | "horizontal""vertical"Layout direction of label and control
opticallyAlign"start" | "end"Applies optical alignment to the child control via negative margin using its gutter
idstringOverride the auto-generated id used for htmlFor/aria linking
childrenReactElement | (fieldProps) => ReactNodeForm control; receives id, aria-describedby, and aria-invalid