feat(slider): add fullWidth prop

This commit is contained in:
Eric Liu 2022-06-18 06:12:19 -07:00
commit ecc4e521bb

View file

@ -35,6 +35,12 @@
/** Set to `true` to hide the text input */ /** Set to `true` to hide the text input */
export let hideTextInput = false; export let hideTextInput = false;
/**
* Set to `true` for the slider to span
* the full width of its containing element.
*/
export let fullWidth = false;
/** Set an id for the slider div element */ /** Set an id for the slider div element */
export let id = "ccs-" + Math.random().toString(36); export let id = "ccs-" + Math.random().toString(36);
@ -143,7 +149,10 @@
{labelText} {labelText}
</slot> </slot>
</label> </label>
<div class:bx--slider-container="{true}"> <div
class:bx--slider-container="{true}"
style="{fullWidth ? 'width: 100%' : undefined}"
>
<span class:bx--slider__range-label="{true}">{minLabel || min}</span> <span class:bx--slider__range-label="{true}">{minLabel || min}</span>
<div <div
bind:this="{ref}" bind:this="{ref}"