Behive Tech Registry

Form Field

v0.3.0

Dumb wrapper that provides label + hint/error + required-marker layout around any form control (`Checkbox`, `Input`, `Textarea`, `Select`, `Toggle`, ...) — the same job AntD's `Form.Item` does. The control itself owns none of this chrome; it just needs an `id` matching `htmlFor`.

pnpm add @behivetech/forms.form-field

Dumb wrapper that provides label + hint/error + required-marker layout around any form control (Checkbox, Input, Textarea, Select, Toggle, ...) — the same job AntD's Form.Item does. The control itself owns none of this chrome; it just needs an id matching htmlFor.

Usage

hint is hidden whenever error is present. If label, hint, and error are all omitted, FormField renders as a plain wrapper around children.

Known limitation: FormField doesn't automatically wire aria-describedby from the control to the hint/error text — pass it yourself if you need that linkage today.

Props

PropTypeDefaultDescription
labelReactNode—Field label
htmlForstring—Associates the label with the control — pass the same id you give the control
hintReactNode—Supporting hint text; hidden while error is present
errorReactNode—Error message; also visually marks the field as invalid
requiredbooleanfalseShows a required marker next to the label
childrenReactNode—The form control this field wraps (required)
classNamestring—Additional class names

Compositions

Open all 4 →

Properties

FormField props

PropTypeDefaultDescription
children*ReactNode—The form control this field wraps
classNamestring—Additional class names to merge with the component root element
errorReactNode—Error message; also visually marks the field as invalid
hintReactNode—Supporting hint text; hidden while `error` is present
htmlForstring—Associates the label with the control — pass the same id you give the control
labelReactNode—Field label
requiredboolean—Shows a required marker next to the label

Also accepts the native attributes of its root element (className, aria-*, event handlers, …).