components icon indicating copy to clipboard operation
components copied to clipboard

[Tabs] Provide an alignTabs property

Open ddyrcz opened this issue 9 years ago • 5 comments

Bug, feature request, or proposal:

feature request

What is the expected behavior?

Regarding to design doc there should be property [alignTabs]

image

Doc: https://docs.google.com/document/d/1djxF6AKGijZl6LOoJ0asFbkf1-GqSAp1CSIyurtKVog/preview#

What is the current behavior?

There is no such a property

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

I have to center the labels align

Instead of this:

image

I would like to aligh them like this:

image

ddyrcz avatar Apr 14 '17 20:04 ddyrcz

From my perspective, it wouldn't be quite as bad if you could simply use @angular/flex-layout on the elements... e.g.:

  <nav mat-tab-nav-bar fxLayout="row" fxLayoutAlign="space-around center">
    ...
  </nav>

Except that with the mat-tab-nav-bar directive, it creates an internal <div> to register cdkObserveContent.

A work-around requires use of ::ng-deep in the style:

.mat-tab-nav-bar {
  ::ng-deep .mat-tab-links {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
  }
}

cpboyd avatar Jan 19 '18 14:01 cpboyd

The property is called mat-align-tabs and it's been available for a long time. See https://material.angular.io/components/tabs/examples#tab-group-align.

crisbeto avatar Apr 05 '21 10:04 crisbeto

@crisbeto How to set the alignment via a variable?

mat-align-tabs="{{tabAlign}}" when tabAlign 'start' or 'center' or 'end'

rajibhasan11 avatar Apr 08 '21 13:04 rajibhasan11

<mat-tab-group [attr.mat-align-tabs]="tabAlign"> should be enough.

crisbeto avatar Apr 08 '21 15:04 crisbeto

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.