Slider

A Slider widget wrapping the native <input type="range">

Slider
//<code-header>
fiddle.title = 'Slider';
//</code-header>
new Slider({
    appendTo : targetElement,
    width    : 200
});

const slider = new Slider({
  text: 'Choose value'
});

Slider options
//<code-header>
fiddle.title = 'Slider options';
//</code-header>
new Slider({
    appendTo : targetElement,
    width    : 200
});

new Slider({
    appendTo  : targetElement,
    width     : 200,
    showValue : 'thumb'
});

new Slider({
    appendTo  : targetElement,
    width     : 200,
    showSteps : true,
    step      : 10,
    showValue : 'thumb'
});

new Slider({
    appendTo : targetElement,
    text     : 'Text + value',
    width    : 200
});

new Slider({
    appendTo  : targetElement,
    text      : 'Text',
    showValue : false,
    width     : 200
});

new Slider({
    appendTo    : targetElement,
    text        : 'Tooltip',
    showValue   : false,
    showTooltip : true,
    width       : 200
});

Configs

89

Common

listenersEvents

Other

max: Number= 100Also a property

Maximum value

Minimum value

showSteps: Boolean= false

Show the step markers

showTooltip: Boolean= false

Show the slider value in a tooltip

showValue: Boolean | thumb= true

Show value in internal label (specify true), or in the thumb (specify 'thumb').

Step size

Text for the sliders internal label. Appends value if showValue is true

A config object for the tooltip to show while hovering the slider.

By default, the change event is fired when a change gesture is completed, ie: on the mouse up gesture of a drag.

Configure this as true to fire the change event as the value changes during a drag.

Unit to display next to the value, when configured with showValue : true

Initial value. String value allows to link value by reference name.

Example:

new Slider({
    text      : 'Tick height',
    value     : 100,
}

new Slider({
    text      : 'Tick height',
    value     : 'up.tickSize',
}

Width of the value label when showValue is enabled. If a number is specified, px will be used.

When not specified, the width will be calculated based on the longest possible value string.

columnWidget
rtlRTL
spanWidget

Accessibility

ariaLabelWidget
keyMapKeyMap

CSS

clsWidget
colorWidget
htmlClsWidget
styleWidget
uiWidget

DOM

adoptWidget
appendToWidget
contentWidget
datasetWidget
htmlWidget
idWidget
tagWidget
titleWidget

Float & align

alignWidget
anchorWidget
centeredWidget
draggableWidget
floatingWidget
xWidget
yWidget

Label

labelLabelable
labelClsLabelable
labelPositionLabelable
labelWidthLabelable

Layout

alignSelfWidget
dockWidget
flexWidget
heightWidget
hiddenWidget
marginWidget
maxHeightWidget
maxWidthWidget
minHeightWidget
minWidthWidget
textAlignWidget
weightWidget
widthWidget

Misc

dataFieldWidget
disabledWidget
localeClassLocalizable
localizableLocalizable
maskedWidget
ownerWidget
readOnlyWidget
refWidget
rippleWidget
tabWidget

Scrolling

Properties

76

Class hierarchy

isSlider: Boolean= truereadonly
Identifies an object as an instance of Slider class, or subclass thereof.
isSlider: Boolean= truereadonlystatic
Identifies an object as an instance of Slider class, or subclass thereof.
isDelayableDelayable
isEventsEvents
isKeyMapKeyMap
isLabelableLabelable
isLocalizableLocalizable
isWidgetWidget

Other

Get input element.

max: Number= 100Also a config

Maximum value

min: Number= 0Also a config

Minimum value

Step size

Text for the sliders internal label. Appends value if showValue is true

By default, the change event is fired when a change gesture is completed, ie: on the mouse up gesture of a drag.

Configure this as true to fire the change event as the value changes during a drag.

Unit to display next to the value, when configured with showValue : true

Initial value. String value allows to link value by reference name.

Example:

new Slider({
    text      : 'Tick height',
    value     : 100,
}

new Slider({
    text      : 'Tick height',
    value     : 'up.tickSize',
}

Width of the value label when showValue is enabled. If a number is specified, px will be used.

When not specified, the width will be calculated based on the longest possible value string.

$namestaticWidget
columnWidget
rtlRTL
spanWidget
typestaticWidget

Accessibility

keyMapKeyMap

CSS

clsWidget

DOM

appendToWidget
contentWidget
datasetWidget
elementWidget
htmlWidget
idWidget
styleWidget

Float & align

xWidget
yWidget

Layout

alignSelfWidget
flexWidget
heightWidget
marginWidget
maxHeightWidget
maxWidthWidget
minHeightWidget
minWidthWidget
widthWidget

Lifecycle

configBase

Misc

cellInfoWidget
disabledWidget
labelLabelable
localeHelperLocalizable
localeManagerLocalizable
readOnlyWidget
refWidget
tabWidget
tooltipWidget

Visibility

hiddenWidget
isVisibleWidget

Widget hierarchy

ownerWidget
parentWidget

Functions

58

Configuration

applyDefaultsstaticBase

Events

Float & align

alignToWidget
setXYWidget
showByWidget
toFrontWidget

Lifecycle

createstaticWidget
destroystaticBase
initClassstaticWidget

Misc

attachTooltipstaticWidget
fromElementstaticWidget
fromSelectorstaticWidget
getByIdstaticWidget
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Other

composeWidget
createOnFrameDelayable
disableWidget
enableWidget
focusWidget
LstaticLocalizable
maskWidget
onEvents
recomposeWidget
relayAllEvents
triggerEvents
unEvents
unmaskWidget

Visibility

hideWidget
showWidget

Widget hierarchy

closestWidget
containsWidget
ownsWidget
queryWidget
queryAllWidget
upWidget

Events

16

Fired after the slider value changes (on mouse up following slider interaction).

// Adding a listener using the "on" method
slider.on('change', ({ value, userAction, source }) => {

});
ParameterTypeDescription
valueNumber

The value

userActionBoolean

Triggered by user taking an action (true) or by setting a value (false)

sourceSlider

The slider

Fired while slider thumb is being dragged.

// Adding a listener using the "on" method
slider.on('input', ({ source, value }) => {

});
ParameterTypeDescription
sourceSlider

The slider

valueNumber

The value

catchAllEvents
destroyEvents
focusInWidget
focusOutWidget
hideWidget
paintWidget
readOnlyWidget
recomposeWidget
resizeWidget
showWidget

Event handlers

16

Called after the slider value changes (on mouse up following slider interaction).

new Slider({
    onChange({ value, userAction, source }) {

    }
});
ParameterTypeDescription
valueNumber

The value

userActionBoolean

Triggered by user taking an action (true) or by setting a value (false)

sourceSlider

The slider

Called while slider thumb is being dragged.

new Slider({
    onInput({ source, value }) {

    }
});
ParameterTypeDescription
sourceSlider

The slider

valueNumber

The value

onDestroyEvents
onFocusInWidget
onHideWidget
onPaintWidget
onResizeWidget
onShowWidget

Typedefs

6

CSS variables

47
NameDescription
--b-slider-thumb-sizeThumb size
--b-slider-thumb-elevationThumb elevation (box-shadow)
--b-slider-thumb-borderThumb border
--b-slider-track-heightTrack height
--b-slider-step-sizeStep indicator size
--b-slider-step-widthStep indicator width, overrides `--b-slider-step-size` if set
--b-slider-step-heightStep indicator height, overrides `--b-slider-step-size` if set
--b-slider-step-opacityStep indicator opacity
--b-slider-ring-contentRing pseudo content (material)
--b-slider-value-border-radiusValue display border-radius ("tooltip" docked after the slider)
--b-slider-thumb-value-sizeThumb size when showing value in the thumb (`showValue: "thumb"`)
--b-slider-thumb-text-colorThumb text color (when showing value in the thumb)
--b-slider-step-lesser-colorColor for lesser steps
--b-slider-value-colorText color for the value display ("tooltip" docked after the slider)
--b-slider-track-colorTrack color
--b-slider-track-borderTrack border
--b-slider-step-border-radiusStep indicator border-radius
--b-slider-colorSlider color
--b-slider-value-backgroundBackground for the value display ("tooltip" docked after the slider)
--b-slider-thumb-colorThumb color
--b-slider-step-colorSlider step color
Disabled
--b-slider-disabled-colorDisabled color
--b-slider-disabled-thumb-colorThumb color when disabled
--b-slider-disabled-track-colorTrack color when disabled
Focused
--b-slider-thumb-focus-outline-offsetFocus outline offset for the thumb
--b-slider-thumb-focus-outline-widthFocus outline width for the thumb
--b-slider-thumb-focus-outline-colorFocus outline color for the thumb

Inherited