iulianraduat / react-select-material-ui

A react SELECT component based on react-select and looking like a material-ui component
MIT License
73 stars 18 forks source link

Will be great to see a react hook form integration with validations and error handling #40

Closed josoroma-zz closed 3 years ago

josoroma-zz commented 3 years ago

https://react-hook-form.com/get-started#IntegratingwithUIlibraries

iulianraduat commented 3 years ago

Hi @josoroma, When do you think can this kind of cases (validation or error) can happen? Thanks, Iulian

josoroma-zz commented 3 years ago

I made it controllable by RHF:

const options: string[] = ["New York", "London", "Vienna", "Budapest"];

...

    <Controller
      name={name}
      control={control}
      variant={variant}
      SelectProps={{
        isCreatable: true,
        msgNoOptionsAvailable: "All options are selected",
        msgNoOptionsMatchFilter: "No option matches the filter",
      }}
      render={({ onChange, value }) => (
        <MultipleSelect options={options} onChange={onChange} values={value} />
      )}
    />

Now I am gonna add it errors handling I guess.