1

I am using Native select from material ui because simple select is some issue when NVDA is enabled so I want style Native select options style same as simple select menu item style .

Can anyone please help me on this

import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import InputLabel from '@material-ui/core/InputLabel';
import FormControl from '@material-ui/core/FormControl';
 import Select from '@material-ui/core/Select';
  const useStyles = makeStyles((theme) => ({
   formControl: {
   margin: theme.spacing(1),
   minWidth: 120,
  },
   selectEmpty: {
   marginTop: theme.spacing(2),
   },
   }));

 export default function NativeSelects() {
 const classes = useStyles();
 const [state, setState] = React.useState({
  age: '',
  name: 'hai',
 });
 const handleChange = (event) => {
const name = event.target.name;
setState({
  ...state,
  [name]: event.target.value,
});
 };
  return (
<div>
  <FormControl className={classes.formControl}>
    <InputLabel htmlFor="age-native-simple">Age</InputLabel>
    <Select
      native
      value={state.age}
      onChange={handleChange}
      inputProps={{
        name: 'age',
        id: 'age-native-simple',
      }}
    >
  
      <option value={10}>Ten</option>
      <option value={20}>Twenty</option>
      <option value={30}>Thirty</option>
    </Select>
  </FormControl>   
</div>
);}

I want this type of style in native option enter image description here

samli prajapati
  • 273
  • 7
  • 16
  • You can get help if you can show the code that you are working on. – m4n0 Nov 12 '22 at 08:15
  • added code please check – samli prajapati Nov 12 '22 at 08:52
  • There are only a few style attributes that are available on the `option` element, does this answer your question, [How to style the option of an select element](https://stackoverflow.com/questions/7208786/how-to-style-the-option-of-an-html-select-element)? – RubenSmn Nov 12 '22 at 13:48

0 Answers0