Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove the Material Stepper header

I want to get rid of the header navigation on the material stepper. Please suggest how can I do it? I tried setting the following css but didn't seems to work:

.mat-horizontal-stepper-header-container{display: none}

Here is stackblitz link of the stepper. https://stackblitz.com/edit/angular-material2-beta-ybbnhe?file=app%2Fapp.component.html

enter image description here

like image 553
RV. Avatar asked Aug 06 '18 23:08

RV.


3 Answers

You need to use a combination of ::ng-deep to get around shadow DOM and the !important flag to get around Materials own stylings:

::ng-deep .mat-horizontal-stepper-header-container {
  display: none !important;
}
like image 185
Simon K Avatar answered Oct 22 '22 16:10

Simon K


@Simon K answer is correct. But it will affect all the stepper in your app. But if you want to use it for your specific component, use :host before the ::ng-deep. Then it will not affect other stepper (if any) in your application. For example of @Simon K' answer-

:host ::ng-deep .mat-horizontal-stepper-header-container {
  display: none !important;
}
like image 6
Md Rafee Avatar answered Oct 22 '22 14:10

Md Rafee


Extend CSS and use additional attribute on the element to hide just specific use-case of it.

mat-stepper[hide-header] .mat-horizontal-stepper-header-container {
  display:none;
}
<mat-stepper hide-header orientation="horizontal" #stepper>
like image 2
baHI Avatar answered Oct 22 '22 14:10

baHI