-
-
Notifications
You must be signed in to change notification settings - Fork 448
Closed
Labels
Description
My tabs are rendered from a prop (simplified example:tabs: ['Hi', 'There']
).
If I delete a tab that is currently selected, another tab doesn't get selected/rendered, and it just shows no content. Rather than making a user have to deal with selectedIndex
in this situation, it would be nice if the component automatically selected another tab (perhaps the first tab, or the tab prior to the deleted tab, would be sensible options). This allows me to keep my component stateless and simple.
<Tabs>
<TabList>
{tabs.map(content => (<Tab>{content}</Tab>)}
</TabList>
{tabs.map((content, index) => (
<TabPanel>
<div>
{content} - <span onClick={() => this.deleteTab(index)}>Delete</span>
</div>
</TabPanel>
)}
</Tabs>