Slider
A slider to select a value or range from a given range
Examples
Base
Show code
Sizes
Show code
Variants
Show code
Customise
Show code
Tick and label
Show code
Range
Show code
Class props
Slider component
A slider to select a value or range from a given range
html
<o-slider></o-slider>
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
ariaLabel | Accessibility aria-label to to be passed to the slider thumb element. | string | - | From config: slider: { |
biggerSliderFocus | Increases slider size on focus | boolean | - | false |
disabled | Slider will be disabled | boolean | - | false |
format | Define v-model format | "percent" | "raw" | row , percent | From config: slider: { |
formatter | Function to format the tooltip label for display | ((value: number) => string) | - | |
indicator | Show indicators | boolean | - | false |
lazy | Update v-model only when dragging is finished | boolean | - | false |
locale | Date format locale | string | string[] | - | From config: { |
max | Maximum value | number | - | 100 |
min | Minimum value | number | - | 0 |
v-model | The input value state | [number, number] | number | - | |
override | Override existing theme classes completely | boolean | - | |
range | Enable range slider | boolean | - |
|
rounded | Rounded thumb | boolean | - | From config: slider: { |
size | Vertical size of slider | string | small , medium , large | From config: slider: { |
step | Step interval of ticks | number | - | 1 |
ticks | Show tick marks | boolean | - | false |
tooltip | Show tooltip when thumb is being dragged | boolean | - | From config: slider: { |
tooltipAlways | Tooltip displays always | boolean | - | false |
tooltipVariant | Color of the tooltip | string | primary , info , success , warning , danger , and any other custom color | From config: slider: { |
variant | Color of the slider | string | primary , info , success , warning , danger , and any other custom color | From config: slider: { |
Events
Event name | Properties | Description |
---|---|---|
update:model-value | value number | number[] - updated modelValue prop | modelValue prop two-way binding |
change | value number | number[] - updated modelValue prop | on value change event |
dragging | value number | number[] - updated modelValue prop | on dragging event |
dragstart | on drag start event | |
dragend | on drag end event |
Slots
Name | Description | Bindings |
---|---|---|
default | Define additional slider ticks here |
SliderTick component
html
<o-slider-tick></o-slider-tick>
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
label | Tick label | string | - | |
override | Override existing theme classes completely | boolean | - | |
value | Value of single tick | number | - |
|
Slots
Name | Description | Bindings |
---|---|---|
default | Override tick content, default is label prop |
Sass variables
Current theme ➜ Oruga
SASS Variable | Default |
---|---|
$slider-background | transparent |
$slider-margin | 1em 0 |
$slider-mark-size | 0.75rem |
$slider-font-size | var(--#{$prefix}base-font-size) |
$slider-rounded-borded-radius | var( --#{$prefix}base-border-radius-rounded) |
$slider-thumb-background | var(--#{$prefix}white) |
$slider-thumb-border | 1px solid var(--#{$prefix}grey-light) |
$slider-thumb-radius | var(--#{$prefix}base-border-radius) |
$slider-thumb-shadow | none |
$slider-thumb-to-track-ratio | 2 |
$slider-thumb-transform | scale(1.25) |
$slider-tick-background | var(--#{$prefix}primary) |
$slider-tick-radius | var(--#{$prefix}base-border-radius) |
$slider-tick-to-track-ratio | 0.5 |
$slider-tick-width | 3px |
$slider-track-background | var(--#{$prefix}grey-lighter) |
$slider-fill-background | var(--#{$prefix}primary) |
$slider-track-border-radius | var(--#{$prefix}base-border-radius) |
$slider-track-border | 0px solid var(--#{$prefix}grey) |
$slider-track-disabled | 0.5 |
$slider-track-radius | var(--#{$prefix}base-border-radius) |
$slider-track-shadow | 0px 0px 0px var(--#{$prefix}grey) |
See ➜ 📄 Full scss file
Current theme ➜ Bulma
SASS Variable | Default |
---|---|
$slider-colors | var.$colors |
$slider-radius | css.getVar("radius") |
$slider-background | css.getVar("grey-lighter") |
$slider-color | css.getVar("primary") |
$slider-track-border | 0px solid css.getVar("grey") |
$slider-track-shadow | 0px 0px 0px css.getVar("grey") |
$slider-thumb-background | css.getVar("scheme-main") |
$slider-thumb-radius | css.getVar("radius") |
$slider-thumb-border | 1px solid css.getVar("grey-light") |
$slider-thumb-shadow | none |
$slider-thumb-to-track-ratio | 2 |
$slider-tick-to-track-ratio | 0.5 |
$slider-tick-width | 3px |
$slider-tick-radius | css.getVar("radius") |
$slider-tick-background | css.getVar("grey-light") |
$slider-tick-label-size | 0.75rem |
See ➜ 📄 Full scss file
Current theme ➜ Bootstrap
SASS Variable | Default |
---|---|
$slider-tick-width | 0.25rem |
$slider-tick-height | 0.25rem |
$slider-tick-radius | 50% |
$slider-tick-bg | var(--#{$prefix}gray) |
See ➜ 📄 Full scss file