# Form Collect field values, validate them and submit or reset a form. [Interactive guide](/docs/forms) · Forge 3.2.0 Use the API for your installed version. Run `npx --no-install wss3-forge api --json` inside the project. ## Implementation guidance ### When to use it Use Form when the form must coordinate typed fields, validation, pending state and submission. ### How to compose it Render each FormField control from its callback and forward the provided identification and ARIA props. Use FormActions for the form commands. ### What to verify Check invalid submission focuses the first failing field, reset restores initial values, and pending submission prevents duplicate requests. ## Usage ```tsx import { Form, FormField, FormActions } from 'wss3-forge' ``` - Wrap your form fields in
with an onSubmit handler - Use to add labels, descriptions, and validation rules - FormField labels a single input returned by its render function. For a compound control, forward the supplied id, name, and ARIA properties to the input. - Validation runs on blur and on submit. The first invalid field receives focus after a failed submit. - Use a reset button to restore initialValues and clear validation feedback. For externally controlled values, pass values and onValuesChange. - Named native fields are included in onSubmit. Registered fields keep their typed values, and only mounted, enabled fields are validated. - Place submit and reset buttons in a CardFooter by passing the same form id to each button’s form prop. - Use the pending render state to show a loading submit button during asynchronous validation or submission. ```tsx {({ value, onChange, onBlur }) => ( )} ``` ## Runnable examples ### Issue report ```tsx import { useId, useState } from 'react' import { Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Input, Text, Textarea, Form, FormField } from 'wss3-forge' function IssueReportExample() { const formId = useId() const [report, setReport] = useState<{ title: string; details: string } | null>(null) return Report an issue Save a report in this preview with the steps that led to the issue.
setReport(null)} onValuesChange={() => setReport(null)} onSubmit={values => setReport({ title: String(values.title), details: String(values.details) })}> {({ value, onChange, onBlur }) => } {({ value, onChange, onBlur }) =>