I'm attempting to create a mat-slider with a thumb label that remains visible at all times.
Below is my mat-slider component:
<mat-slider
class="example-margin"
[disabled]="false"
[thumbLabel]="true"
[tickInterval]="tickInterval"
[(ngModel)]='value'
>
</mat-slider>
To ensure the Thumb Label stays on screen, I've applied the following CSS properties:
::ng-deep .mat-slider-thumb-label {
transform: rotate(45deg) !important;
border-radius: 50% 50% 0 !important;
}
::ng-deep .mat-slider-thumb {
transform: scale(0) !important;
}
::ng-deep .mat-slider-thumb-label-text {
opacity: 1 !important;
}
However, when I disable interaction with the mat-slider
by setting disabled=true
, the styles disappear along with the thumb label, leaving an empty space in the bar.
This is what I want to achieve while keeping interactions disabled:
https://i.sstatic.net/QQX3J.png
You can view a demo here.