Search code examples
htmlcssangular-material2

angular/material2 mat-spinner resize


Is there any possible way to change size of mat-spinner or mat-progress-circle?

I read the documentation of mat-spinner and mat-progress-circle but they said that mat-diameter is discontinued and the spinner will take the parent element's size.

How can I put mat-spinner in a mat-button to the left corner without changing the height of the button?

<button mat-button>
   <mat-spinner style="float:left;"></mat-spinner> 
   processing....
</button>

I also tried to change the height using in-line css like

style="float:left;height:10px;width:10px;

but is not pretty to see.


Solution

  • I'm not sure why your styling did not bring the desired results. As you mentioned, the svg content inside md-spinner will scale to the container's size, so applying width and height to the md-spinner should work.

    CSS

    md-spinner {
      float:left; 
      width: 24px; 
      height: 24px; 
      margin: 5px 10px 0px 0px;
    }
    

    Template

    <button md-raised-button>
      <md-spinner></md-spinner>Raised Button with spinner
    </button>
    

    Plunk

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

    Is this what you'd like to achieve?