Field
Form field primitives that wire labels, controls, descriptions, and validation messages without owning the actual input component.
Installation
dgadd is not public on npm yet. Until the first release, pack @diffgazer/add from the repository and install that tarball into this app, which is what puts dgadd on pnpm exec.
The hosted registry is not public yet because r.b4r7.dev does not resolve. Use this source checkout or a local registry preview until the endpoint returns 200.
Diffgazer packages are not yet published to npm. Until the first release, pack @diffgazer/ui and @diffgazer/keys from the repository and install those tarballs.
UI components require Tailwind CSS v4. Local copy mode imports src/styles/styles.css; package mode uses @diffgazer/ui CSS once packages are available.
Usage
Examples
Valid, invalid, disabled
Checkbox and Select
Form integration
API Reference
Field
Field.Label
Field.Control
Field.Description
Field.Error
Accessibility
Notes
Form Contract
Field.Control clones one control element and applies id, required, disabled, aria-invalid, and aria-describedby from Field.Root. A disabled Field.Root remains authoritative even if the child explicitly sets disabled={false}. A required Field.Root remains authoritative even if the child explicitly sets required={false}. Use Field.Control with Input, Textarea, Select, or another control that accepts those props. A consumer id on the control child wins: Field keeps the child's own id and points Field.Label's htmlFor at it. Slots register through context, so wrapping Field.Label, Field.Description, or Field.Error in a layout element keeps the ARIA wiring intact.
One Helper Slot
Field.Description and Field.Error share one visible row. While the field is invalid and Field.Error has content, the description renders screen-reader-only and the error takes its place, so field height does not depend on validity and a form validating on blur does not push the input the user is correcting. The description keeps its id and its place in aria-describedby, which lists the error first so the problem is announced before the hint.
InputGroup vs Field
InputGroup is only a decorated input shell for prefix and suffix content. Plain text affixes are aria-hidden decoration; interactive affixes need explicit labels. Field is the form wrapper for label, helper text, and error wiring.
Source
Install via CLI: pnpm exec dgadd add ui/field.
Highlighted source loads after this disclosure opens. Browse the source repository.