Error summary visibility
Show or hide a form-level error summary based on the aggregate validation result.
Conform · Pipe
form.valid is Conform form metadata indicating whether the form currently has no validation errors. Use it for conditional error summaries, submit UI, and form-level accessibility attributes.
The form.valid pipe is a boolean form-state value exposed by Conform's form metadata. It is true when the form currently has no validation errors, so it can drive conditional UI such as error summaries, submit-state messaging, or accessibility attributes.
form.validboolean: true when the form currently has no validation errors; otherwise false.
import { useForm } from '@conform-to/react';
export function ProfileForm() {
const [form] = useForm();
return (
<form
id={form.id}
onSubmit={form.onSubmit}
aria-describedby={!form.valid ? form.errorId : undefined}
>
<button type="submit">Submit</button>
</form>
);
}Use the form metadata's valid flag to conditionally expose the form-level error description while the form has validation errors.
Show or hide a form-level error summary based on the aggregate validation result.
Set aria-describedby only while the form has errors.
Disable or conditionally render submit-related UI when validation fails.
form.valid is a boolean in the form metadata. It is true when the form currently has no validation errors and false when validation errors exist.
Follow-up: How can it support accessibility? Use it to conditionally set aria-describedby to the form's error ID only while the form is invalid.
Use the value in conditional rendering or attribute expressions. For example, an error summary or submit-related message can be shown when !form.valid.
Follow-up: What should be combined with validity for a less intrusive message? Also track whether the form has been touched, so an error message is not shown before interaction.
The flag belongs to the metadata returned by useForm and is available wherever that metadata is used. It reflects the form's current aggregate validation result rather than a particular field's state.
Follow-up: How would you handle a field-specific condition? Read that field's own valid metadata instead of the aggregate form.valid value.
useFormMetadatauseFormerrorstouchederrorIdgetFormProps