Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Commit

Permalink
feat(Slider): add precision prop to customize decimal places of slide…
Browse files Browse the repository at this point in the history
…r value
  • Loading branch information
Michael Weitnauer committed Mar 10, 2021
1 parent 628ef6a commit ad4c41b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
export let connect = Array.isArray(value) ? true : 'lower';
export let color = 'primary';
export let step = null;
export let precision = 0;
export let margin = null;
export let limit = null;
export let padding = null;
Expand Down Expand Up @@ -55,7 +56,7 @@
noUiSlider.create(sliderElement, {
cssPrefix: 's-slider__',
format: {
to: (v) => Math.round(v),
to: (v) => v.toFixed(precision),
from: (v) => Number(v),
},
start: value,
Expand Down

0 comments on commit ad4c41b

Please sign in to comment.