TeamWertarbyte / material-ui-chip-input

A chip input field using Material-UI.
https://mui.wertarbyte.com/#material-ui-chip-input
MIT License
737 stars 208 forks source link

Validation: is it an array or string? #341

Open ghost opened 3 years ago

ghost commented 3 years ago

I'm using useForms with Yup validations and a thing I'm missing from this component is a way to validate properly what is input. It happens because when I'm inserting a new chip it's a string and when I press enter it goes into an array of strings. I want to validate both the array and the string (to check length for example) but only the string is sent to onBeforeAdd or Yup.

Would you consider also sending the array to a validator or onBeforeAdd? I think it'd be way more transparent.

Thank you!