components icon indicating copy to clipboard operation
components copied to clipboard

[Tabs] Nav bar should paginate labels on overflow

Open MariovanZeist opened this issue 9 years ago • 59 comments

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

"md-tab-nav-bar" component to have same functionality / visual fidelity as the "md-tab-group" component.

What is the current behavior?

The 2 components are disjoint and improvements made in "md-tab-group" component won't show up in the "md-tab-nav-bar" component

What are the steps to reproduce?

See the default demo included in this repository

What is the use-case or motivation for changing an existing behavior?

I am building a large application that uses lazy loaded modules to implement specific features. I want to display specific functionality in tabs. For example we have a customer object which can contain up to 11 tabs which represent specific data pertaining to this customer. The current "md-tab-group" implementation is already looking great (Dynamic height, scrolling, pagination when tabs exceed container width etc..) But with the "md-tab-nav-bar" component none of these features are available.

Which versions of Angular, Material, OS, browsers are affected?

Material 2.0.0-alpha.11

Is there anything else we should know?

MariovanZeist avatar Dec 11 '16 16:12 MariovanZeist

Unlike MdTabGroup, MdTabNavBar doesn't own the body, so I'm not sure whether it should support dynamic height. However I would desperately want to have pagination/scrolling and compact mode for narrow screens to be implemented for MdTabNavBar.

antonmoiseev avatar Dec 25 '16 14:12 antonmoiseev

Sure, pagination/scrolling would be very nice!

paulogr avatar Dec 26 '16 18:12 paulogr

I may be suffering from a related issue. Cant seem to get lists to be independently scroll-able within a tab.

see this plunkr for demo: http://plnkr.co/edit/h67A8ZSeH747E3oYKdv5?p=preview

Interestingly, independently scroll-able lists work fine in md-tab-nav-bar tabs.

sherwopj avatar Feb 16 '17 15:02 sherwopj

Is there a published timeframe for pagination on MdTabNavBar?

zpydee avatar May 19 '17 10:05 zpydee

Also desperately need this functionality.

SargoDarya avatar May 19 '17 15:05 SargoDarya

Any news?

ruslan5t avatar Jun 21 '17 17:06 ruslan5t

Also interested in updates as well.

moshecmc avatar Jun 22 '17 14:06 moshecmc

These features is very necessary

tgladyshev avatar Jul 09 '17 15:07 tgladyshev

any workarounds while we wait? ;) I need this too.. meanwhile I'll try to write my own workaround

My stupid workaround! :) i've used md-tab-group... with style="width:100vw;" and no content... now I just have to style it and add some click-events.

  <md-tab-group style="width:100vw;">
    <md-tab label="Tab 1"></md-tab>
    <md-tab label="Tab 2"></md-tab>
    <md-tab label="Tab 3"></md-tab>
    <md-tab label="Tab 4"></md-tab>
    <md-tab label="Tab 5"></md-tab>
  </md-tab-group>

axhcypod avatar Aug 04 '17 10:08 axhcypod

almost one year later ... any news on that ? no wonder why most of the dev move to react ...

anymos avatar Nov 16 '17 11:11 anymos

@anymos This is an open source project. If you need something, you can always create and use a fork or send a PR. Most projects I work with have more incoming feature requests than developers can implement. I expect this should not be a surprise to many developers.

Please try to keep comments constructive.

csvn avatar Nov 16 '17 12:11 csvn

I have built a workaround for this issue. I've put the nav bar in a div and I added a overflow-x: hidden and added a display: flex to it. In the component I've taken control of the div and used it's scrollLeft property(div.nativeElement.scrollLeft) Afterwards I added 2 buttons which constrolled the left/right scrolling. It's an easy and quick solution until this issue is resolved fully.

GandalfTheWhite1 avatar Dec 18 '17 11:12 GandalfTheWhite1

@qwr1000 Hey, could you post a codepen for your quickfix?

ngs-jameslee avatar Dec 19 '17 01:12 ngs-jameslee

@qwr1000 Thanks for the idea! I created a simple component using styles form tab header. Here's the code: http://plnkr.co/edit/8locpYNLpLEDOKxWneY7

oleges avatar Dec 20 '17 15:12 oleges

Some additions to the superb solution by @oleges

  • Turn off left/right arrow buttons if the screen is wide enough
  • If screen is wide enough expand the bottom-border line fully
  • Also disable wrapping in Firefox

http://plnkr.co/edit/qJTwkJPzriMhKynhRPBS?p=preview

petersalomonsen avatar Jan 12 '18 10:01 petersalomonsen

Also came here looking for this issue. Probably naive but this be something that would be a matter of copying the logic from the one component that already works (mat-tab-group) to this one?

niwrA avatar Jan 26 '18 11:01 niwrA

This is a great case of getting community contribution. Unfortunately we only have a limited set of resources with lots of higher priority issues/features to work on.

If anyone wants to work on this, here's a branch on my fork that has some work done to refactor the tab header so it can be used by both the tab group and nav bar: https://github.com/andrewseguin/material2/tree/tabs-pagination-refactor

To be honest, not sure that's the final design or best implementation, just playing with it to see what possible. Still needs some cleanup in implementation and tests.

andrewseguin avatar Jan 30 '18 20:01 andrewseguin

@andrewseguin do you still need help with that fork?

mdelorimier avatar Mar 14 '18 13:03 mdelorimier

Here you guys go!

tab navigation

priority navigation

tommyc38 avatar Mar 14 '18 15:03 tommyc38

I like https://angular-material-priority-nav.stackblitz.io/ really a lot - can we have that out of the box? pretty please!

pgrm avatar Mar 15 '18 11:03 pgrm