G
Tokens
TypographySpacingColorRadiusShadowMotion

TextToggle

Active toggle


    <TextToggleGroup>
      <TextToggle isActive>{demoFilms[11]}</TextToggle>
      <TextToggle>{demoFilms[13]}</TextToggle>
      <TextToggle>{demoFilms[14]}</TextToggle>
    </TextToggleGroup>
  

Full width


    <TextToggleGroup hasFullWidth>
      <TextToggle isActive>{demoFilms[11]}</TextToggle>
      <TextToggle>{demoFilms[13]}</TextToggle>
      <TextToggle>{demoFilms[14]}</TextToggle>
    </TextToggleGroup>
  

Examples

With state


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

Props

TextToggleGroup

Name
Type
Default
children
node
hasFullWidth
bool

TextToggle

Name
Type
Default
children
node
isActive
bool
onClick
func