Ciao, to make the border
color white you have to:
Define a Theme
object in which you have to define a primary
color and override the MuiOutlinedInput
like this:
const Theme = {
palette: {
primary: {
contrastText: "#FFFFFF",
dark: "#FFFFFF",
main: "#FFFFFF",
light: "#FFFFFF"
}
},
overrides: {
MuiOutlinedInput: {
root: {
position: "relative",
"& $notchedOutline": {
borderColor: "#FFFFFF"
},
"&:hover:not($disabled):not($focused):not($error) $notchedOutline": {
borderColor: "#FFFFFF",
"@media (hover: none)": {
borderColor: "#FFFFFF"
}
},
"&$focused $notchedOutline": {
borderColor: "#FFFFFF",
borderWidth: 1
}
}
}
}
};
(I know, this will override all the MuiOutlinedInputs you will use in your project but I found only this way).
To pass this Theme
to the TextField
, you have to wrap it into a ThemeProvider
and create a mui theme:
import { ThemeProvider, createMuiTheme } from "@material-ui/core/styles";
...
const theme = createMuiTheme(Theme);
...
return (
<ThemeProvider theme={theme}>
<div class={classes.root}>
<TextField />
....
</ThemeProvider>
);
For the text color and the default label, you have to use InputProps
and InputLabelProps
with a className
like:
<TextField
variant="outlined"
id="fullName"
label="Username"
InputProps={{
className: classes.input
}}
InputLabelProps={{
className: classes.input
}}
/>
The css will be:
const useStyles = makeStyles(() => ({
input: {
color: "white"
}
}));
Here a codesandbox example.