question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MdSlider custom thumb label text

See original GitHub issue

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

New Inputs in MdSlider to add a suffix or prefix to the thumb-label-text

What is the current behavior?

Thumb label text simply shows a number

What are the steps to reproduce?

Providing a Plunker (or similar) is the best way to get the team to see your issue. Plunker template: https://goo.gl/DlHd6U

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

If you want a slider that has a specific unit, like $, or m2 or min.

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

Material 2

Is there anything else we should know?

simply something like this would do:

<span class="mat-slider-thumb-label-text">{{displayPrefix}}{{displayValue}}{{displaySuffix}}</span>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

11reactions
willshowellcommented, May 25, 2017

Instead of prefix/suffix, what about something similar to autocomplete’s displayWith?

comp.html

<md-slider
 [thumbLabel]="true"
 [displayLabelAs]="labelFn">
</md-slider>

comp.ts

labelFn(value: number): string {
  return `${value} cm`;
}
1reaction
YeomansIIIcommented, Aug 26, 2017

Any work being done on this? I can try and implement @willshowell’s solution and make a pull request. We need this feature to show slider value as audio track time when dragging. This seems very valuable as it’s open to any kind of formatting needed from value to label.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I display thumb label all the time for material slider?
If you place the suggested styles in your custom-theme.scss, or in styles.css then it will work. If you use ::ng-deep, then you'll want...
Read more >
Slider - KivyMD 1.1.1 documentation
The color in (r, g, b, a) or string format of the thumb when the slider is active. New in version 1.0.0. MDSlider...
Read more >
Flutter Slider widgets: A deep dive with examples
Slider is one of the basic Flutter widgets that can be used to select from a range of values by moving the slider...
Read more >
Ui_template md-slider help - workable, almost complete
setTimeout(function() { $span_lower.text(msg.payload); $slider_lower.val ... Does anyone know how to move the thumb on a md-slider ?
Read more >
How To Display Label Using Slider Of Material Component
... slider is being changed. to <mdslider> which tells it whether to always display the thumb label. Modular and customizable Material Design UI...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found