Style react-phone-input-2 material style with theme from MUI

1k Views Asked by At

I want to use react-phone-input-2 in my MUI application and it needs to match the look and feel of the other inputs I have in a form. All the other inputs inherit their styling from my MUI theme, however react-phone-input-2 does not. I have not been able to find a reasonable way to use theme styling on this input. Does anyone know how to do this?

Here is what I tried:

          <ThemeProvider theme={theme}>
              <PhoneInput
                inputClass='mega-test'
                
                inputProps={{
                  name: "phone",
                  required: true,
                  size: "small",
                  theme: { theme },
                  
                }}
                country={"us"}
                countryCodeEditable={false}
              />
            </ThemeProvider>
1

There are 1 best solutions below

0
Yurii Brusentsov On

You can try to use the react-international-phone package instead.

You can find an example of use with Material UI in docs.