Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨Tabs: controlled mode #3036

Merged
merged 5 commits into from
Aug 29, 2023
Merged

✨Tabs: controlled mode #3036

merged 5 commits into from
Aug 29, 2023

Conversation

oddvernes
Copy link
Collaborator

@oddvernes oddvernes commented Aug 28, 2023

resolves #3022

The feature request was to fix the active prop on <Tabs.Tab> so it could be used to manually set active tab when using tabs as router links, however this proved difficult due to how the internal logic controls the active state. So instead I opted to implement it the way MUI does it by having a value prop on <Tabs.Tab> that sets the active tab if it matches the value sent into activeTab.
I also created a storybook story with a practical example using react-router-dom

@oddvernes oddvernes merged commit 016df0e into develop Aug 29, 2023
@oddvernes oddvernes deleted the OOVE/3022-tabs-active-attribute branch August 29, 2023 07:56
@vegar
Copy link

vegar commented Aug 29, 2023

It's an improvement for sure.

I see that the active property still exist on Tab component. What stops the next person for trying to use it the way I did?
Should it be removed? Is it possibel to remove it?

@oddvernes
Copy link
Collaborator Author

I put an /** @ignore */ on it so at least it doesnt show up in the documentation. It is used internally, controlled by TabList

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<Tabs.Tab active> attribute not respected
2 participants