Autorotate through tabs on a TabContainer

Is there a way to rotate through the tabs automatically?
Like start at 0, wait amount of duration, then goto 1....etc..

Maybe, but have you considered the Carousel component and its Autoplay configuration?

2 Likes

Tab auto-index

Create an Expression Binding on currentTabIndex.

floor(
  (now(1000) / 3000) // 3000 ms on each tab
  % 3                // number of tabs
)

You may need further code if you want to stop the auto-index.

2 Likes

oooo...aaaahhh, I will defiantly look at it!

Defiantly! Wow, brave man! :person_fencing:

Nit:
You should be able to use the len expression function on props.tabs, to avoid hardcoding in the number of tabs.

Thanks, Paul!

// New and improved version!
floor(
  (now(1000) / 3000) // 3000 ms on each tab
  % len({this.props.tabs})
)
1 Like

lol, tis but a scratch!

1 Like