Skip to content

Tab Component Like Code Editor Tabs #2606

Answered by TheSisb
gautam678 asked this question in General
Discussion options

You must be logged in to vote

Hi @gautam678,

For something like this we recommend using the Tabs Primitive. Here's a codesandbox showing how you can solve all three of your issues: https://codesandbox.io/s/epic-elion-84w3l6?file=/src/index.tsx

  • Only displays the contents of the currently selected tab
  • Has a close button
  • Able to update routes on tab change

Styling is left as an exercise to the reader. You can get inspiration from how we style our Tabs component.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gautam678
Comment options

Answer selected by TheSisb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants