Field

Form

A comprehensive form field component with label, control, description, and error handling. Provides validation state management and accessibility features.

Installation

bash
1npx @dinachi/cli@latest add field

Run the CLI command above to automatically install the component and its dependencies.

Examples

Default Field

A basic field with label, control, and description

We'll never share your email.

Field with Validation

Interactive field with real-time validation feedback

Must be at least 3 characters.

Field with Error

Field displaying an error state

Required Field

Fields marked as required with visual indicators

Your legal name as it appears on documents.

We'll use this for account recovery.

Disabled Field

Field in a disabled state

This field cannot be modified.

API Reference

PropTypeDefaultDescription
name
required
stringThe name of the field for form submission
disabled
booleanfalseWhether the field is disabled
invalid
booleanfalseWhether the field has validation errors
required
booleanfalseWhether the field is required
validate
(value: any) => string | undefinedCustom validation function