Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

md-tab, buttons in right top corner, angular material

Is there any good way of getting some buttons in the right corner of the md-tab directive?

I tried some with position:absolute etc but it find kinda hacky.

<div style="position:absolute; top:15px; right:5px; z-index:5000">
  <md-button class="md-primary md-icon-button toolbar-button" ng-click="vm.toggleFullScreen()" aria-label="toggle fullscreen">
    <md-icon md-font-icon class="zmdi zmdi-fullscreen"></md-icon> AAA
  </md-button>
</div>

<md-content>
    <md-tabs>
      <md-tab label="one">
      </md-tab>
      <md-tab label="two">

      </md-tab>
      <md-tab label="three">

      </md-tab>
    </md-tabs>
  </md-content>

http://codepen.io/anon/pen/yVbrjR

like image 513
Joe Avatar asked Nov 23 '16 18:11

Joe


1 Answers

Yes, you can do that by adding buttons inside md-tabs, and editing md-tab-data in your stylesheet.

HTML

<md-content>
    <md-tabs>
      <md-button class="md-primary md-icon-button toolbar-button" ng-click="vm.toggleFullScreen()" aria-label="toggle fullscreen">
        <md-icon md-font-icon class="zmdi zmdi-fullscreen"></md-icon> AAA
      </md-button>

      <md-tab label="one">
      </md-tab>
      <md-tab label="two">

      </md-tab>
      <md-tab label="three">

      </md-tab>
    </md-tabs>
  </md-content>

CSS

md-tab-data{
  opacity: 1;
  display: table;
  right: 0;
  left: initial;
  z-index: 20;
}

Demo

http://codepen.io/anon/pen/QGgKEq

like image 77
Patryk Łucka Avatar answered Oct 14 '22 20:10

Patryk Łucka