89

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.

Mel
  • 5,837
  • 10
  • 37
  • 42
Vijay R
  • 923
  • 1
  • 6
  • 10

4 Answers4

292

With the latest update you should use the diameter property:

<mat-spinner [diameter]="70"></mat-spinner>

The diameter represents the amount of pixels for both the width and the height of the spinner. In this case it has a size of 70x70 pixels.

See the following stackblitz example:

https://stackblitz.com/edit/angular-material2-progress-spinner

Philipp Kief
  • 8,172
  • 5
  • 33
  • 43
15

here is the answer :

<mat-spinner mode="indeterminate" style="margin:0 auto;" [diameter]="30"></mat-spinner> 
Tuba Salçi
  • 301
  • 2
  • 4
10

you can add this to your css file:

mat-spinner {
  zoom: 0.2
}
Karthik
  • 1,447
  • 1
  • 18
  • 26
  • 6
    [zoom](https://developer.mozilla.org/en-US/docs/Web/CSS/zoom#Specifications) is nonstandard and firefox doesn't support it – barbsan Jan 17 '19 at 11:58
7

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?

András Szepesházi
  • 6,483
  • 5
  • 45
  • 59
  • 1
    It didn't work for me either until I added `!important` to all of the styles. – dan Sep 15 '17 at 15:31