G
Tokens
TypographySpacingColorRadiusShadowMotion

Tab

Active tab


    <TabGroup>
      <Tab isActive>{demoFilms[11]}</Tab>
      <Tab>{demoFilms[13]}</Tab>
      <Tab>{demoFilms[14]}</Tab>
    </TabGroup>
  

Height

Add height="100%" to the TabGroup to make it fill the height of its parent.


    <Box height={9} borderSide="all" paddingX="l">
      <TabGroup height="100%">
        <Tab isActive>{demoFilms[19]}</Tab>
        <Tab>{demoFilms[10]}</Tab>
        <Tab>{demoFilms[21]}</Tab>
      </TabGroup>
    </Box>
  

Full width


    <TabGroup hasFullWidth>
      <Tab isActive>{demoFilms[19]}</Tab>
      <Tab>{demoFilms[10]}</Tab>
      <Tab>{demoFilms[21]}</Tab>
    </TabGroup>
  

Examples

With state


    () => {
      const [activeOption, setActiveOption] = useState(demoFilms[27]);
      return (
        <TabGroup>
          <Tab
            onClick={() => setActiveOption(demoFilms[27])}
            isActive={activeOption === demoFilms[27]}
          >
            {demoFilms[27]}
          </Tab>
          <Tab
            onClick={() => setActiveOption(demoFilms[18])}
            isActive={activeOption === demoFilms[18]}
          >
            {demoFilms[18]}
          </Tab>
          <Tab
            onClick={() => setActiveOption(demoFilms[17])}
            isActive={activeOption === demoFilms[17]}
          >
            {demoFilms[17]}
          </Tab>
        </TabGroup>
      )
    }
  

Props

TabGroup

Name
Type
Default
height
oneOfType
number
string
6
children
node
hasFullWidth
bool

Tab

Name
Type
Default
children
node
isActive
bool
onClick
func