Skip to content
Related Articles

Related Articles

How to create mat-button-toggle-group as read only mode in AngularJS ?

Improve Article
Save Article
  • Last Updated : 30 Nov, 2020
Improve Article
Save Article

Angular Material is a UI component library developed by the Angular team to build design components for desktop and mobile web applications. 

In order to install it, we need to have angular installed in our project, once you have it, you can enter the below command and can download it.

Installation syntax:

ng add @angular/material


  • First, install the angular material using the above-mentioned command.
  • After completing the installation, Import ‘MatButtonToggleModule,’ from ‘@angular/material’ in the app.module.ts file.
  • Then use <mat-button-toggle-group> and </mat-button-toggle> tags to create angular button toggle group.
  • As the MatButtonToggleModule doesn’t consist of read-only property, we can use the disabled property to make it read-only.
  • Once done with the above steps then serve or start the project.

Code implementation:



import { NgModule } from '@angular/core';
import { BrowserModule } from 
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from 
import { MatButtonModule } from 
import { MatButtonToggleModule } from 
  imports:      [ BrowserModule, 
                  MatButtonToggleModule ],
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ]
export class AppModule { }



<mat-button-toggle-group name="techno" 
    <mat-button-toggle value="html">
    <mat-button-toggle disabled value="css">
    <mat-button-toggle value="javascript">
    <mat-button-toggle value="jquery">


Observation: If you clearly observe the above output, you can understand that you can’t select and it is the way how read-only property looks like.

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!