Skip to content

Default Tab Selection #4237

Feb 7, 2025 · 3 comments · 6 replies
Discussion options

You must be logged in to vote

Hi @richiethie, Dosu was on the right track by using the state. We discourage using primitives though as they are unstyled. I have created a working CodeSandbox that when selecting the second tab and then using the disabled button allows you to select any tab you like. Just a note, an active tab is mandatory as a tab panel should always be displayed for the component.

The hook utilizes the baseId and "should" append the tab index so set the ids of the tabs. I put it in quotes because in this sandbox, for some reason it is adding 2 to the index.

Be sure to use the hook and set it on the component:

const { ...tabState } = useTabState({
    baseId: "hook-example",
  });

 <Tabs state={tabState}

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@dosubot
Comment options

@richiethie
Comment options

@dosubot
Comment options

@richiethie
Comment options

@dosubot
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by roxanagomez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External This Discussion was posted by a non-Twilio Paste consumer
3 participants