components icon indicating copy to clipboard operation
components copied to clipboard

Make slider thumb label always visible

Open michaelpwilson opened this issue 9 years ago • 9 comments

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

michaelpwilson avatar May 25 '17 16:05 michaelpwilson

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

ocarreterom avatar May 26 '17 10:05 ocarreterom

@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;
}

willshowell avatar May 26 '17 12:05 willshowell

Not in the spec, but seems reasonable

mmalerba avatar May 30 '17 23:05 mmalerba

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

michaelpwilson avatar May 31 '17 23:05 michaelpwilson

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

CDMU avatar Jun 15 '17 03:06 CDMU

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

::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;
  }

}

eroak avatar Oct 07 '17 13:10 eroak

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

vsarathy avatar Oct 14 '17 19:10 vsarathy

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

mmalerba avatar Jul 16 '18 18:07 mmalerba

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.