#How to navigate to specific tabs from outside my component when the order of tabs is dynamic?

4 messages · Page 1 of 1 (latest)

bitter chasm
#

As of now I can only navigate to tabs with their tabValue being an integer like ".../tab?=0" , ".../tab?=1" etc. But the problem is, in my component tabs are rendered according to some conditions, and sometimes some tabs are not rendered at all, so "tab?=2" does not always lead to the desired tab depending on the table instance. Now if I want to navigate to a specific tab from another component using navigate react-dom what would be the best way to do that? Can I navigate to them using their assigned string values, like navigating to "tab?=first" where the tab has value="first"? Or any alternate way?

thorn chasm
# bitter chasm As of now I can only navigate to tabs with their tabValue being an integer like ...

Since 5.0 Tabs use values instead of order to get active tab, it does not matter whether tabs are dynamic or not. I do not understand your issue, you can have a look at how tabs are managed on mantine.dev though – https://github.com/mantinedev/mantine/blob/dev/docs/src/components/MdxPage/MdxPageTabs/MdxPageTabs.tsx

GitHub

React components library with native dark theme support - mantine/MdxPageTabs.tsx at dev · mantinedev/mantine

bitter chasm
thorn chasm