v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS

FormField

Connect a visible label, help, error and control reliably.

Interactive preview

Use an address you can access.

Usage

import { FormField, Input } from "@devvy-ui/react";

<FormField label="Workspace email" description="Used for project updates." required>{field => <Input {...field} name="email" type="email" />}</FormField>

API reference

Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:

PropTypeDefaultDescription
label / childrenReactNode / render functionrequiredVisible label and a control receiving FieldControlProps.
description / errorReactNode—Connected help and validation message.
required / controlIdboolean / stringfalse / generated IDNative required and optional explicit control ID.

Accessibility & behavior

Platform Behavior & Guidelines

Spread the supplied props on one labelable control. Stable SSR IDs connect label/help/error; error sets aria-invalid. Validation and state belong to your app. Preserve supplied aria-describedby when adding your own descriptions. The forwarded ref targets the field wrapper.

Source ownership

Run npx @devvy-ui/cli init once in your React project, then add the source:

npx @devvy-ui/cli add form-field

Make the source yours.

Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.

FormField.tsxREACT / TSX

Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.