Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
130
rated 0 times [  135] [ 5]  / answers: 1 / hits: 13836  / 4 Years ago, sun, october 18, 2020, 12:00:00

I want to change the placeholder fontsize of Material Ui Autocomplet. Is there any way?


enter


             <Autocomplete
multiple
id="tags-outlined"
options={top100Films}
getOptionLabel={(option) => option.title}
defaultValue={[top100Films[13]]}
filterSelectedOptions
size="small"

renderInput={(params) => (
<TextField
{...params}

variant="outlined"

placeholder="Enter Transshipment Ports"


/>
)}
/>

More From » reactjs

 Answers
5

In your example, you can target the input element of the component you render in renderInput which is TextField using makeStyles


const useStyles = makeStyles({
customTextField: {
"& input::placeholder": {
fontSize: "20px"
}
}
})

<TextField
classes={{ root: classes.customTextField }}
{...params}
variant="outlined"
placeholder="Enter Transshipment Ports"
/>

Example below using forked MUI demo


Edit


[#2466] Tuesday, October 13, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
stacied

Total Points: 124
Total Questions: 84
Total Answers: 98

Location: Ivory Coast
Member since Sun, Mar 7, 2021
3 Years ago
;