How to change outline color of Material UI Select component (in outlined mode) when dropdown is opened ( currently it is blue )

Viewed 584

How do I change the outline color of Material-UI select component outlined variant the right way? Help me change this blue color to red please, I would be really grateful

Image for reference

component for reference code for Reference

<FormControl variant="outlined" fullWidth size={'small'} className={classes.formControl}>
                        <InputLabel id="xAxisDropdown">Select Hardware Platforms</InputLabel>
                        <Select
                           multiple
                           fullWidth
                           labelId="processor"
                           id="processor"
                           value={this.state.selectedProcessors}
                           name={'selectedProcessors'}
                           onChange={this.handleMultiselectChange}
                           label="Select Hardware Platforms"
                           // className={classes.selectBox}
                           classes={{root:classes.selectBox}}
                           renderValue={(selected) => {
                              let names = selected.map(selectedId => {
                                 return this.state.processorList[
                                    this.state.processorList.findIndex(
                                       (processor) => {
                                          return processor.id === selectedId
                                       })
                                    ].nameText
                              })
                              return names.join(', ')
                           }}

                        >
                           {this.state.processorList.map((processor, index) => {
                              return (
                                 <MenuItem key={index} value={processor.id}>
                                    <MainThemeCheckbox
                                       checked={this.state.selectedProcessors.indexOf(processor.id) > -1}
                                    />
                                    <ListItemText primary={processor.selectElement}/>
                                 </MenuItem>
                              )
                           })}
                        </Select>
                     </FormControl>
2 Answers

You can use some CSS or component styles trick to change the main color but the recommended way is theming your project and choose your palette for primary and secondary colors.

You can use some tools like this to create and test your theme and you can have multiples themes in a one project.

The best way to achieve this is by editing a particular generic color(eg. Primary, Secondary) in the Theme object and injecting it with ThemeProvider into the particular dropdown by wrapping the dropdown in the ThemeProvider element and setting the theme object with the edited values

Related