[Tabs] Re-implementation and client-side navigation #878
Unanswered
marcialfps
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Feature/s
Approaches
In order to have the above features we need to rethink our Tabs component. We have to take into account how other design systems have implemented this type of component. In the next sections I will explain what we need to change about our component to support the two features.
Individual Tab as child
In this case I have studied 7 design systems. Of them, only one (Gestalt) uses the tabs property as an array as we do in our component. Each element of the array can have the following properties:
{| href: string, id?: string, indicator?: "dot" | number, ref?: {| current: ?HTMLElement |}, text: React.Node, |}
As we can see,
href
is supported, butonChange
property is also provided to allow other functionalities when user changes to another tab.But what do the other 6 design systems have in common? They all use Tab and content as children of the Tabs component in a very similar way:
Atlassian
Base Web
Headless UI
We can conclude from this first section is that the use of children is standarized by many design systems.
Custom tab and client-side navigation
The feature explained above allows these design systems to support custom tabs. In some cases, such as Atlassian or Chakra, custom tabs can be used within
TabList
.Chakra UI
Other cases, such as Headless and Material use a prop called as or component which can receive an HTML primitive type or a React component. This prop was also explained in #757 .
Gestalt, the design system that uses a similar approach with the tabs array says the following in the documentation:
So this new approach opens up a very similar discussion to the Link component and the way we support React Router or NextJS Link.
Other considerations
Base web uses renderAll which allows to render all the content of each tab. This functionality can be useful for SEO.
Beta Was this translation helpful? Give feedback.
All reactions