mui / mui/base-ui

[form] Form level validation / Standard schema support

Open
#4,737 2 comments 0 reactions 0 assignees View on GitHub
component: form type: new feature
Dominant language
TypeScript
Stars
10.9k
Forks
543
Avg merge
1d 20h
Merged PRs (30d)
101

Description

# Feature request

## Summary

Currently, we have `validate` function available on `Field.Root` components. It will be great if we can have `validate` on `Form` as well to validate entire object at once.

It will be better if we can support [standard schema](https://standardschema.dev/) we can try to validate it with available schema validator.

## Examples in other libraries

- [You can pass yup schema in Formik Form](https://formik.org/docs/api/formik#validationschema-schema----schema)
- [You can pass zod/ajv/yup schema in React Hook Form](https://www.react-hook-form.com/get-started/#SchemaValidation)
- [Form level validation in @mantine/form](https://mantine.dev/form/validation/#formrootrule)

## Motivation

I use [HeyAPI](https://heyapi.dev/) to generate SDK for backend APIs. It can generate zod/valibot schema for request payloads. I wanted to integrate that with base ui so I can just pass that generated schema in `Form` component to validate all the fields.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.