Reputation: 752
I just cant figure this one out guys. I want to change the fontsize of the label thats with my textfield. So far i can only change the fontsize of the input, but not the label.
Textfield:
<TextField
className={classes.TextField}
id="input-with-icon-textfield"
label="Zoeken"
InputProps={{
startAdornment: (
<InputAdornment position="start">
<Search />
</InputAdornment>
),
}}
onChange={(e) => {this.setTextFilter(e.target.value);}}
/>
Added a picture so you can see what i mean with a label.
Upvotes: 7
Views: 15635
Reputation: 20088
We can use InputLabelProps and style object inside the TextField, something below
<TextField
InputLabelProps={{
style: {
fontSize: 18,
}
}}
..../>
Upvotes: 0
Reputation: 494
Another option here : insted overrides you can use as Typography component inside the label props. See the example
<TextField
label={
<Typography variant="headline" component="h3"> Zoeken </Typography>
} ..../>
Hope this will help someone.
Upvotes: 7
Reputation: 752
I ended up adding some code to my main mui theme.
const theme = createMuiTheme({
palette: {
primary: {
main: '#39870c',
ligth: '#6cb842',
dark: '#005900'
},
secondary: {
light: '#01689b',
main: '#0044ff',
contrastText: '#ffcc00',
},
},
overrides: {
MuiInputLabel: {
root: {
color:'black',
fontSize: 13,
},
},
}
});
With overrides I could basically change anything. I hope this helps someone out in the future, because this was really annoying to find.
Upvotes: 9