Closed mucahit closed 3 years ago
@mucahit Can you give an example use case for this ?
@mucahit Can you give an example use case for this?
I needed to collapse a Card when a particular tab is opened but couldn't do it since we don't have any info/callback about which tab is active. I did a tiny workaround as below, passed an additional Button inside of the tab item, and controlled it from there
[
{id: "dashboard", content: "Dashboard"},
{
id: "cash-flow",
content: (
<Button isDisabled={true}>
{"Cash flow"}
</Button>
)
},
{
id: "accounting",
content: (
// handleAccountingClick collapses the Card
<Button
onClick={handleAccountingClick}
shouldPreventDefault={false}
shouldStopPropagation={false}>
{"Accounting"}
</Button>
)
}
];
We need to add
onTabChange
prop to the Tab component to listen to tab changes.Pass target (a.k.a the active item index)
index
toonTabChange