Skip to content

Field

Form field wrapper: label, hint, control, error — accessibly wired.

Prop Type Notes
label React.ReactNode The field label. Sans, medium — the interface talking.
hint React.ReactNode Guidance below the label, above the control.
error React.ReactNode Field-level error. Renders with role="alert" and marks the control aria-invalid.
required boolean Shows a small engraved "required" beside the label.
htmlFor string Control id; generated (and applied to a single element child) if omitted.
className string
children React.ReactNode

Other props pass through to the root element (React.HTMLAttributes<HTMLDivElement>).

Preview

Declarations

TypeScript
export interface FieldProps extends React.HTMLAttributes<HTMLDivElement> {
  /** The field label. Sans, medium — the interface talking. */
  label?: React.ReactNode;
  /** Guidance below the label, above the control. */
  hint?: React.ReactNode;
  /** Field-level error. Renders with role="alert" and marks the control aria-invalid. */
  error?: React.ReactNode;
  /** Shows a small engraved "required" beside the label. */
  required?: boolean;
  /** Control id; generated (and applied to a single element child) if omitted. */
  htmlFor?: string;
  className?: string;
  children?: React.ReactNode;
}

/**
 * Form field wrapper: label, hint, control, error — accessibly wired.
 */
export function Field(props: FieldProps): React.JSX.Element;