Components: Make slider thumb label always visible

Created on 25 May 2017  路  9Comments  路  Source: angular/components

Bug, feature request, or proposal:

Feature request

What is the expected behaviour?

I would like the thumb label to remain visible, not just when the slider is being changed.

What is the current behaviour?

The slider thumb label will only show when the slider is being moved.

https://material.angular.io/components/component/slider

What is the use-case or motivation for changing an existing behaviour?

I don't think existing behaviour should be changed, but maybe an input can be given to <md-slider> which tells it whether to always display the thumb label.

From a design point of view, it is nice to be able to let the user know what the current value is for the slider.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

TypeScript 2.3.3
Angular 4.1.3
Angular Material 2.0.0-beta.5

P5 feature

Most helpful comment

@michaelpwilson you can override it with css for now if you wish

.mat-slider-thumb-label {
  transform: rotate(45deg) !important;
  border-radius: 50% 50% 0 !important;
}

.mat-slider-thumb {
  transform: scale(0) !important;
}

.mat-slider-thumb-label-text {
  opacity: 1 !important;
}

All 9 comments

The slider is following the MD specs https://material.io/guidelines/components/sliders.html#sliders-discrete-slider

@michaelpwilson you can override it with css for now if you wish

.mat-slider-thumb-label {
  transform: rotate(45deg) !important;
  border-radius: 50% 50% 0 !important;
}

.mat-slider-thumb {
  transform: scale(0) !important;
}

.mat-slider-thumb-label-text {
  opacity: 1 !important;
}

Not in the spec, but seems reasonable

Thanks @willshowell! This works apart from when the value is 0.

Hi @michaelpwilson , could you share your method ?
Because I've try to override the css but not work at all, thanks.

@CDMU You should try to wrap the @michaelpwilson method with : ::ng-deep { }

```css
::ng-deep {

.mat-slider-thumb-label {
transform: rotate(45deg) !important;
border-radius: 50% 50% 0 !important;
}

.mat-slider-thumb {
transform: scale(0) !important;
}

.mat-slider-thumb-label-text {
opacity: 1 !important;
}

}

Is there a way to make the thumb label appear at the bottom instead?

Rather than add an option for this to the mat-slider, we will create a cdk-slider that people can use if they want to be able to customize beyond what the mat-slider supports. Follow #10774

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

julianobrasil picture julianobrasil  路  3Comments

MurhafSousli picture MurhafSousli  路  3Comments

vitaly-t picture vitaly-t  路  3Comments

Miiekeee picture Miiekeee  路  3Comments

constantinlucian picture constantinlucian  路  3Comments