bumbag-ui icon indicating copy to clipboard operation
bumbag-ui copied to clipboard

Support Controlled Tabs

Open sam-chuang opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe. I need to know which tab is active, so I can do something(fetch data for instance) when tab is in active state

Describe the solution you'd like If tabs support the controlled state, I guess I can use the selectedId to know which tab is active

Describe alternatives you've considered

  1. provide context store that I can get selectedId and use it to know which tab is active
  2. provide a hook that returns whether tabId is active or not

sam-chuang avatar Oct 23 '20 10:10 sam-chuang

Hey, sorry about the late reply. Ideally, it would be nice to create a pattern like Tabs.State or Tabs.useState just like we do for our Modals so you can choose to control the state. I'll need to add this in. I think it would also be nice to add a prop to defer mounting of a tab panel until the tab is clicked too, which may be a nicer solution to fetch data for a particular tab.

jxom avatar Oct 27 '20 03:10 jxom

Thanks!! those will be very helpful features!!

sam-chuang avatar Oct 28 '20 01:10 sam-chuang