Implement Slider Component
See original GitHub issue@sgomes already doing some work on this.
Notes
Step values need to be able to be quantized to decimal places, e.g. min = 0, max = 5, step = .2
. Possible algorithm: Take the raw value, divide it by step
, round that number, and then multiply the original step value by the rounded number. E.g.
function quantize(val, min, max, step) {
const numSteps = Math.round(val / step);
const quantizedVal = numSteps * step;
return Math.max(min, Math.min(max, quantizedVal));
}
const min = 0, max = 5, step = .2;
quantize(3.56, min, max, step); // 3.6
quantize(2.148692, min, max, step) // 2.2
quantize(1.061733, min, max, step) // 1
Copied from https://github.com/google/material-design-lite/issues/4494
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Building a React slider - Retool
Learn to build a slider in React with `react-slider`, and to customize the various components of the slider (dimensions, values, colors, ...
Read more >React slider tutorial using react-slider - LogRocket Blog
Learn how to create different sliders using react-slider, a React headless component that's easy to build and customize.
Read more >React Slider component - Material UI - MUI
Sliders allow users to make selections from a range of values. Sliders reflect a range of values along a bar, from which users...
Read more >How To Create Range Sliders - W3Schools
Learn how to create custom range sliders with CSS and JavaScript. ... The slider handle (use -webkit- (Chrome, Opera, Safari, Edge) and -moz-...
Read more >How to Use Sliders (The Java™ Tutorials > Creating a GUI ...
A JSlider component is intended to let the user easily enter a numeric value bounded by a minimum and maximum value. If space...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Eng outline: https://docs.google.com/document/d/1gSZO62mZNjBpSZMyT0K3gNRjOJ6xCiDFa3VaupOdgmE/edit
https://docs.google.com/document/d/1gSZO62mZNjBpSZMyT0K3gNRjOJ6xCiDFa3VaupOdgmE/edit that’s a good way of defining what’s needed 😃