Skip to main content

angular material - How to use stroked Button

app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})


export class AppComponent {
  counter: number = 0;

  updateCounter(){
    this.counter++;
  }
}
app.component.html

<h2>Angular Material - How to use stroked Button</h2>

<h1>{{counter}}</h1>


<div style="display:flex; justify-content:space-between;
      padding:20px;background-color:gray;">
  <button mat-stroked-button (click)="updateCounter()">
    Basic Button
  </button>
  
  <button mat-stroked-button color="primary" 
    (click)="updateCounter()">
      Primary Color
  </button>
  
  <button mat-stroked-button color="accent" 
    (click)="updateCounter()">
      Accent Color
  </button>
</div>


<div style="display:flex; justify-content:space-between;
      padding:20px; background-color:gray;">
  <button mat-stroked-button color="warn" 
    (click)="updateCounter()">
      Warn
  </button>
  
  <a mat-stroked-button href="https://www.android--code.com/" 
    target="_blank">
      Link Button
  </a>
</div>


<div style="padding:20px; background-color:gray;">
  <button mat-stroked-button disabled
    (click)="updateCounter()">
      Disabled Button
  </button>
</div>
app.module.ts [import]

import {MatButtonModule} from '@angular/material/button';
More Angular tutorials