Custom labels #124
-
Can't seem to find a way to have custom labels on my slider, is it possible to pass an array of strings and use them as the labels? Right now i'm using JavaScript to replace the current label values with my desired values but a way to build it with the slider would be better |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I managed to do it like this: RangePips.svelte `
{#if (all && first !== false) || first }
{labelDown(e)}}
on:pointerup={(e)=>{labelUp(pipVal(min),e)}}
>
{#if all === 'label' || first === 'label'}
{#if prefix}{prefix}{/if}
{#if customPips}{customPips[0]}{:else}{formatter(fixFloat(min), 0, 0)}{/if}
{#if suffix}{suffix}{/if}
{/if}
{/if}
`
If no customPips is passed it will use the default logic else it uses the customPips. You can pass the custom labels like this:
|
Beta Was this translation helpful? Give feedback.
-
I guess you didn't read the docs? also see this discussion #72 |
Beta Was this translation helpful? Give feedback.
I guess you didn't read the docs?
https://simeydotme.github.io/svelte-range-slider-pips/en/examples/formatter/
the
formatter
prop handles this already .. I'd advise against editing the source for this :)also see this discussion #72