Currently, I am attempting to customize the MUI tab by changing the indicator from a line to a background color. Through my research, I discovered that using TabIndicatorProps and setting a style of display:none
eliminates the indicator completely. However, when I try
backgroundColor:"color"
, the line color changes but I'm struggling to make it span the entire background instead of just a line.
I experimented with some potential solutions, such as adding height:100%
to the TabIndicatorProps, which resulted in creating the background but obscured the text within the tab. Likewise, applying opacity: .8
gave me the desired effect, but the text became too dark and I was unable to adjust it for active tabs.
Expected Tab Image Current Tab Image
<Box sx={{ width: '100%', bgcolor: 'background.paper' }}>
<Tabs TabIndicatorProps={{
style: {
backgroundColor: '#D2603D',
borderRadius: '5px',
},
}} value={value} onChange={handleChange}>
<Tab textColor='blue' onClick={handleClick} sx={{
backgroundColor: '#F4F5F9',
borderRadius: '5px',
}} label="Daily" />
< Tab sx={{
backgroundColor: '#F4F5F9',
}} label="Weekly" />
<Tab sx={{
backgroundColor: '#F4F5F9',
borderRadius: '5px'
}} label="Monthly" />
</Tabs>
</Box >