mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.53k stars 1.32k forks source link

[docs] Add recipe for Yup validation schema for editing values #4009

Open tsafadi opened 2 years ago

tsafadi commented 2 years ago

Duplicates

Latest version

Summary 💡

Add Yup validation schema to validate user inputs client-side.

Examples 🌈

No response

Motivation 🔦

No response

Order ID 💳 (optional)

No response

flaviendelangle commented 2 years ago

We need more information here What are you trying to validate ? Why do you need it to be done on our side ?

tsafadi commented 2 years ago

As of right now, the data grid allows custom client-side validation. It would be nice if there is an integration for Yup schemas to reduce complexity. Essentially passing a Yup schema as a prop to the grid (similar to how it works in Formik or React Hook Form)

flaviendelangle commented 2 years ago

OK so it would be to validate the rows when using our editing features With something similar as Formik

Syntarex commented 2 years ago

I would love to see that too! You could reuse the object keys of the yup validation scheme and match the column field value.

oliviertassinari commented 2 years ago

As far as I understand it, this feature shouldn't be built-in, however, it should be easy to implement user-land. Could somebody share how it can be done today with the current API? I think that it will help to see how it can be improved.

m4theushw commented 2 years ago

Instead of built-in support I propose we add a demo in the Recipes pages.