question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Tabs] Header with icon+text not vertically aligned

See original GitHub issue

Bug, feature request, or proposal:

Tab with Icon and Text label not aligned vertically center, currently aligned bottom

What is the expected behavior?

Expect to align text and icon in middle. (as In Button with Icon and Label) Tab Label and Icon are aligned in screen shot 2018-02-25 at 8 56 32 pm

What is the current behavior?

Tab with Icon and Text label not aligned vertically center, currently aligned bottom

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.
StackBlitz starter: https://goo.gl/wwnhMV

https://stackblitz.com/angular/rlqokrmnevel?file=app%2Ftabs-template-label-example.html

<mat-tab>
        <ng-template mat-tab-label>
          <mat-icon>attach_file</mat-icon> Attach File
        </ng-template>
<div class="demo-tab-content">
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla venenatis ante augue.
#### What is the use-case or motivation for changing an existing behavior?
</div>
</mat-tab>

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

@5.2.2

Is there anything else we should know?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:5
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
Domvelcommented, Mar 20, 2018

Workaround: Wrap the icon and text in a div container with class for:

.flex-vert-center {
  display: flex;
  align-items: center;
}

BUT in my opinion (and I’m sure I’m not alone with it) the material ui framework has to handle it. Please add official support for icon and text.

3reactions
julianobrasilcommented, Feb 25, 2018

@sujithtomy, what I found in specs is that when you have icon and text, you should align both at the center (horizontally) and the icon should be in one line and the text on the line below the icon. Like this:

image

MatTable has a header row height of 48px, recommended for text or icon labels, but the specs say that to hold an icon + text, it should use a 72px-height header. You can modify its css to increase the height up to the right value if you really want icon + text in the label and also wants to follow the specs.

[edit]: forgot to link the stackblitz demo => https://stackblitz.com/edit/angular-ikazee

Read more comments on GitHub >

github_iconTop Results From Across the Web

Align material icon vertically - Stack Overflow
The "i" tag is for italic text. For icons, use "span" or "div". In this case, you probably want "span". – osiris.
Read more >
Components - Bootstrap
Vertical variation. Make a set of buttons appear vertically stacked rather than horizontally. Split button dropdowns are not supported here. Button Button.
Read more >
How to Create Divi Vertical Tabs (With & Without Plugin)
In this Divi tutorial, you'll learn how you can easily create Divi vertical tabs with examples using a custom CSS and plugin.
Read more >
Components - NativeBase
Button component takes input such as: Text, Icon, Text with Icon. ... Make use of Left, Body and Right components to align the...
Read more >
Bootstrap All CSS Classes - W3Schools
Class Description Example Category .active Animates a striped progress bar Try it Progress Bars .alert Creates an alert message box Try it Alerts .alert‑info Light‑blue alert...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found