<Form> component extends the HTML <form> element with prefetching, client-side navigation, and progressive enhancement.loading.js and shared layouts are prefetched for instant navigation.useActionState for form state and validation errors.useFormStatus inside form components to show pending states.1import Form from 'next/form';2import { submitForm, FormState } from './actions';34export default function ContactPage() {5const [state, formAction] = useActionState(submitForm, initialState);67return (8<Form action={formAction}>9<input10name="email"11type="email"12aria-invalid={state.errors?.email ? 'true' : undefined}13/>1415{state.errors?.email && <p role="alert">{state.errors.email[0]}</p>}1617<SubmitButton />18</Form>19);20}
`next/form` pairs well with Server Actions for low-friction mutations.
useActionState to surface field-level errors.