Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to programatically switch tabs? #387

Open
1mike12 opened this issue Dec 28, 2023 · 2 comments
Open

How to programatically switch tabs? #387

1mike12 opened this issue Dec 28, 2023 · 2 comments
Labels
question Further information is requested

Comments

@1mike12
Copy link

1mike12 commented Dec 28, 2023

I need to be able to programatically switch to a specific tab, how do we do that?

I wouldve assumed an api where we keep the index in state, and listen back to onIndexChanges,

failing that, a ref to access the internal methods of the container. But can't see any docs about either

@1mike12 1mike12 added the question Further information is requested label Dec 28, 2023
@1mike12
Copy link
Author

1mike12 commented Dec 28, 2023

after looking at the source I found we can do

ref = createRef<Tabs.Container>()
this.ref.current?.jumpToTab("following")

It works but there's still a typescript error
TS2503: Cannot find namespace Tabs

Is there a better way to do this?

@SrAnthony
Copy link

There's a CollapsibleRef type you can use:
const ref = useRef<CollapsibleRef>(null)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants