reactjs - How can I change the underline color of MaterialUI's React Tabs component? - TagMerge
4How can I change the underline color of MaterialUI's React Tabs component?How can I change the underline color of MaterialUI's React Tabs component?

How can I change the underline color of MaterialUI's React Tabs component?

Asked 1 years ago
10
4 answers

Use TabIndicatorProps property to change the underline color.

<Tabs TabIndicatorProps={{style: {backgroundColor: "white"}}}>
   <Tab label='Tab 1'/>
   <Tab label='Tab 2'/>
</Tabs>

Source: link

0

This property can be changed with the inkBarStyle props:

<Tabs inkBarStyle={{backgroundColor: '#e77600'}}>
   <Tab label='Tab 1'/>
   <Tab label='Tab 2'/>
</Tabs>

Source: link

-1

<Tabs indicatorColor="white">
   <Tab label="Tab 1"/>
   <Tab label="Tab 2"/>
</Tabs>

Indicator Color can take any color e.g white, red, green e.t.c

Source: link

0

Wrap your select with <FormControl /> and also add <InputLabel /> as <Select /> sibling. After that, override InputLabel root class and also provide className to select component:
const useStyles = makeStyles((theme) => ({
  formControl: {
    margin: theme.spacing(1),
    minWidth: 120,
  },
  underline: {
    color: 'red' ,
    '&::after': {
      borderBottom: '2px solid red'
    },
    '&::before': {
      borderBottom: '2px solid yellow'
    }
  },
  inputLabelRoot: {
    color: 'red',
  }
}));

export default function SimpleSelect() {
  const classes = useStyles();

  return (
    <div>
      <FormControl className={classes.formControl}>
        <InputLabel classes={{root: classes.inputLabelRoot}}>Age</InputLabel>
        <Select
          className={classes.underline}
        >
          <MenuItem value={10}>Ten</MenuItem>
          <MenuItem value={20}>Twenty</MenuItem>
          <MenuItem value={30}>Thirty</MenuItem>
        </Select>
      </FormControl>
    </div>
  );
}

Source: link

Recent Questions on reactjs

    Programming Languages