react-tabs icon indicating copy to clipboard operation
react-tabs copied to clipboard

Switch component and context instead of compound-components (cloning)

Open drcmda opened this issue 7 years ago • 0 comments

The current structure makes react-tabs a little rigid when it comes to user-land abstractions, like being able to animate these components.

If it had something like a Switch component similar to react-router that takes the current tab and displays it, as well as communication via context instead of cloning elements, then it would be very easy to use things like reactTransitionGroup or Transition.

<Tabs>
    <TabList>
      <Tab>Mario</Tab>
      <Tab>Luigi</Tab>
    </TabList>

    <Transition from={{ opacity: 0 }} enter={{ opacity: 1 }} leave={{ opacity: 0 }}>
      {styles => (
        <Switch style={styles}>
          <TabPanel>Mario</TabPanel>
          <TabPanel>Luigi</TabPanel>
        </Switch>
      )}
    </Transition>

drcmda avatar Jun 17 '18 09:06 drcmda