Adding a "selected" prop for Tab component to enable easy integration with routing libraries like React Router / TanStack Router #44844
Labels
status: waiting for maintainer
These issues haven't been looked at yet by a maintainer
Summary
Hi,
First of all, I do not wish to waste the maintainers' time, I just think this matter will be meaningful for the front-end community :)
The subject at hand is allowing the tabs to be used with navigation in libraries like React Router - making each tab know if it's active using the routes "isActive" prop.
I will start by showing an example of a navigation with different MUI components -
<ToggleButtonGroup/>
combined with
<ToggleButton/>
First, this is a part of an example router - a route that has 3 sub-routes:
This is a component that toggles between the routes,
each is aware of the
isActive
prop and knows whether it is selected or not.This code is extremely comfortable and easy, but unfortunately cannot be implemented with Tabs/Tab.
A tab can never know whether it is selected or not, and it depends on its parent, the
<Tabs>
component.Examples
No response
Motivation
I was just thinking it will be really easy and fun to allow tabs to do what button-toggle(rs) already do..
Plus, many SPA React projects are written with React-Router / TanStack-Router, and I truly believe this will be extremely helpful and widely used in the community 🎄
Search keywords: tab
The text was updated successfully, but these errors were encountered: