You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 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:
aarongarciah
changed the title
Adding a "selected" prop for Tab component to enable easy integration with routing libraries like React Router / TanStack Router
[Tabs] Add selected prop for easy integration with routing libraries
Dec 24, 2024
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: