Overview
Enter a valid email address
Select a role
Choose the user’s permission level.FormField, FormItem, FormLabel, FormDescription, FormMessage — that connect to React Hook Form and uniformly apply A’raf DS token-based styling to labels, helper text, and error messages.
Form is a thin integration layer, not a standalone form UI. It requires
react-hook-form as a peer dependency and pairs with any A’raf DS input component (Input, Select, Checkbox, etc.).Installation
Usage
Variants
Basic Form Field
A single field with label and validation message.With Helper Text
UseFormDescription to add supporting guidance below the input.
Must be at least 8 characters and include a number.
With Validation Error
FormMessage automatically renders the Zod/RHF error message in the error state.
Enter a valid email address
Complete Form Example
Profile settings
Write a short introduction about yourself.
API Reference
Form
The React Hook Form instance returned by
useForm(). Passed to the internal FormProvider.Submit handler. Typically
form.handleSubmit(handler).Additional class names for the
<form> element.FormField
The
control object from useForm().Field name matching the schema key.
Render function receiving registered field props and validation state.
FormItem
Container for a single field — adds consistent vertical spacing between label, control, description, and message.FormLabel
Appends a red asterisk (
*) to indicate required fields.FormDescription
Renders helper text below the input in#667085 muted color.
FormMessage
Automatically reads and displays the validation error for the current field fromfieldState.error. Renders nothing when there is no error.
FormControl
Binds the ARIA attributes (aria-invalid, aria-describedby) between the input and FormMessage. Always wrap your input component with FormControl.
Accessibility
FormLabelrenders a<label>element with aforattribute automatically linked to the input viaFormControlFormMessageusesrole="alert"so screen readers announce validation errors immediately on submitFormControlsetsaria-invalid="true"on the input when a field error existsFormDescriptionis linked to the input viaaria-describedbyfor assistive technology- Required fields should be marked with both the
requiredprop onFormLabeland the Zod.min(1)validation rule
Do’s & Don’ts
Do
- Always wrap inputs with
FormControlto get correct ARIA bindings - Use
FormDescriptionfor guidance the user needs before they fill the field - Use
FormMessagefor validation errors triggered after interaction - Keep labels short and descriptive — “Email address” not “Please enter your email”
Don't
- Don’t use
FormDescriptionfor error messages — useFormMessageinstead - Don’t skip
FormLabel— placeholder text alone is not accessible - Don’t place
FormMessageabove the input — errors should appear below - Don’t use
form.handleSubmitoutside theonSubmitprop — letFormmanage it