Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
Material UI First Tab not showing up

I am having an odd issue where the first Tab is not displaying right. I had experimented around and added a 2nd tab, which shows up just fine. I basically made the 2nd tab have what I wanted the first tab to have. Since I thought that I might have made a mistake, I deleted the first tab and just had the 2nd tab be the first tab...only for it to not show up. Here is my code:

<Tabs
  value={value}
  onChange={handleChange}
  indicatorColor="primary"
  className={classes.tabContainer}
 >
    <Tab label="Today's Picture" />
    <Tab
      className={classes.tab}
      label="Today's Picture"
      component={Link}
      onClick={refreshPage}
      to="/"
    />
    <BasicDatePicker date={props.date} setDate={props.setDate} />
 </Tabs>

The first tab was me experimenting to see if it would show, the 2nd tab is what I want to show up as the first tab. The odd thing that was happening is that when it wasn't showing my first tab, at least hovering over it made the styling I have set up show, but not hovering over it made it look like nothing was there.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I have copied this code from material UI site and it will work fine try this:

    function TabPanel(props) {
  const { children, value, index, ...other } = props;

  return (
    <div
      role="tabpanel"
      hidden={value !== index}
      id={`simple-tabpanel-${index}`}
      aria-labelledby={`simple-tab-${index}`}
      {...other}
    >
      {value === index && (
        <Box sx={{ p: 3 }}>
          <Typography>{children}</Typography>
        </Box>
      )}
    </div>
  );
}

TabPanel.propTypes = {
  children: PropTypes.node,
  index: PropTypes.number.isRequired,
  value: PropTypes.number.isRequired,
};

function a11yProps(index) {
  return {
    id: `simple-tab-${index}`,
    'aria-controls': `simple-tabpanel-${index}`,
  };
}

export default function BasicTabs() {
  const [value, setValue] = React.useState(0);

  const handleChange = (event, newValue) => {
    setValue(newValue);
  };

  return (
    <Box sx={{ width: '100%' }}>
      <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
        <Tabs value={value} onChange={handleChange} aria-label="basic tabs example">
          <Tab label="Item One" {...a11yProps(0)} />
          <Tab label="Item Two" {...a11yProps(1)} />
          <Tab label="Item Three" {...a11yProps(2)} />
        </Tabs>
      </Box>
      <TabPanel value={value} index={0}>
        Item One
      </TabPanel>
      <TabPanel value={value} index={1}>
        Item Two
      </TabPanel>
      <TabPanel value={value} index={2}>
        Item Three
      </TabPanel>
    </Box>
  );
}
about 4 years ago · Juan Pablo Isaza Report

0

I figured it out, once I changed this:

<Tab
      className={classes.tab}
      label="Today's Picture"
      component={Link}
      onClick={refreshPage}
      to="/"
    />

to this:

     <Tab
      className={classes.tab}
      value="Today's Picture"
      label="Today's Picture"
      component={Link}
      onClick={refreshPage}
      to="/"
     />

I basically had to add a value line in my Tab. Once I did that, it worked as intended!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!