I am looking to implement a Tabs
component containing lots (7-9) Tab
components for a desktop view. I do not want to use the scrollable tabs when it exceeds the viewport width on the Tabs
, instead I want the extra Tab
items to be in a More dropdown menu just like the example docs show below:
Tab
directly to the left of the More dropdown, as shown in this screenshot from the doc:The Material UI Tabs Component We can use the Tabs component from Material UI to create a group of tabs. It has a value prop that sets the currently selected tab using its zero-based index. The Tab component creates each tab. Its label prop sets the tab title.
You can add dynamic tabs by reusing the content using React template. Tabs can be added dynamically by passing array of items and index value to the addTab method. Content reuse can be achieved by using the following steps: Declare a template within the function returns jsx element.
Late, but it may help someone.
I was able to achieve dropdown within tabs by using the popover component.
https://codesandbox.io/s/436906013w
It has three tabs - One, Two and Three. Clicking on Tab 'Three' will perform the normal tab change. Clicking on the dropdown arrow next to tab 'Three' will provide the additional options.
It is not an exact solution to the question but can be achieved with a similar approach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With