The "MatToolbar" is a component provided by Angular Material that serves as a container for various types of content, such as titles, icons, and navigation elements. It is commonly used to create a toolbar at the top of a page for a consistent and organized layout. The MatToolbar module is part of the Angular Material library, and it provides styling and layout features to help developers create responsive and visually appealing toolbars in their Angular applications.
Here's a basic example of how you can use the mat-toolbar component in an Angular Material application:
Before writing code in our HTML components, we initially imported and declared the MatChipsModule in "material.module.ts".
We established a mixin named "pageback-toolbar" in "_toolbar-pageback.scss" situated within the "mat-themes" folder. Subsequently, this "_toolbar-pageback.scss" was imported into the "includes.scss" file.
_mat-expansion-panel.scss
@use"@angular/material"as mat;@use"sass:map";@forward"./palette";@forward'./buttons';@use"@project-sunbird/sb-styles/assets/mixins/mixins"as *;@mixinpageback-toolbar($theme) {// Get the color config from the theme. $color-config:mat.get-color-config($theme);// Get the primary color palette from the color-config. $primary:map.get($color-config,'primary'); $accent:map.get($color-config,'accent'); $warn:map.get($color-config,'warn'); $background:map.get($color-config,'background');.mat-toolbar {&.toolbar-pageback {border-radius:1.5rem 1.5rem 0 0;display:flex;align-items:center;margin:0 auto;padding:0.5rem 1rem;width:90%;gap:0.5rem;min-height:4rem;height:auto;flex-wrap:wrap;@includerespond-below(sm) {flex-wrap:wrap;height:auto;padding:1rem;width:100%;padding-bottom:2.5rem; }.thumbnail {height:3rem;width:3rem; }.mat-title { $title-typography: mat.define-typography-config($subheading-2: mat.define-typography-level($font-size: 1rem !important,
$font-family:inherit, $line-height: normal, $font-weight: 700));@include mat.typography-level($title-typography, 'subheading-2');margin:0 0 0.5rem 0;color:mat.get-color-from-palette($primary, 500-contrast);width:95%;white-space:initial; }&__actions {.sb-label-status-error {color:mat.get-color-from-palette($warn);font-size:0.75rem;background-color:mat.get-color-from-palette($warn, 100); } }.mat-flat-button.mat-success,.mat-raised-button.mat-success,.mat-fab.mat-success,.mat-mini-fab.mat-success {@extend%mat-success; } } }}
includes.scss
@import'./toolbar-pageback';
A mixin was crafted and then imported into the "themes.scss" file within the "app-themes" section.
themes.scss
@includepageback-toolbar($theme);
The end result will be as follows in differnt themes: