Skip to content

Vertical Slider ​

A vertical slider with a hover indicator bubble showing the value under the pointer, and an output label that can format the value through a function.

a-sxr-vertical-slider Component ​

Properties ​

PropertyDescriptionDefault Value
active-colorColor of the active (filled) part of the track#2563EB
background-colorBackground color of the track#F1F5F9
border-colorColor of the inactive part of the track#1B1B1F
handle-colorColor of the handle#F1F5F9
handle-outer-radiusOuter radius of the handle0.17
handle-inner-radiusInner radius of the handle0.13
handle-outer-depthDepth of the outer handle0.04
handle-inner-depthDepth of the inner handle0.02
hover-colorHandle color while hovering#0EA5E9
hover-font-sizeFont size of label indicating where user is hovering0.2
hover-heightHeight of label indicating where user is hovering0.35
hover-percentCurrent percentage where user is hovering
hover-widthWidth of label indicating where user is hovering0.7
keyboard-stepPercent added/removed per arrow-key press when focused0.05
keyTextual shortcut key that activates the widget (e.g. 'e')
key-codeLegacy numeric shortcut key (e.g. 13 for Enter)-1
marginMargin around item'0 0 0 0'
onclickJavascript function to execute on click
onhoverJavascript function to execute on hover
opacityTransparency of the vertical slider background1.0
output-font-sizeFont size of label indicating output value0.2
output-functionName of function to calculate output value from percent
output-text-depthDistance from output text to label background0.25
output-widthWidth of label indicating output value1.0
percentCurrent selected slider value, from 0.0 to 1.00.5
slider-bar-depth0.03
slider-bar-widthWidth of the slider track0.08
top-bottom-paddingPadding applied to the track height0.25
heightHeight of item1
widthWidth of item1
html
<a-sxr-vertical-slider
	width="2.5" height="0.75"
	onclick="slideActionFunction"
	percent="0.29"
	margin="0 0 0.05 0"
>
</a-sxr-vertical-slider>

Callback signature ​

The onclick callback receives (percent) — for both pointer and keyboard activation:

js
function slideActionFunction(percent) {
  console.log('vertical slider moved to', percent)
}

Output label ​

output-function names a global function that converts the raw percent into the displayed text:

js
function toDegrees(percent) {
  return Math.round(percent * 360) + '°'
}
html
<a-sxr-vertical-slider output-function="toDegrees" percent="0.5"></a-sxr-vertical-slider>

The label's width, font size and depth are controlled by output-width, output-font-size and output-text-depth.

Hover indicator ​

While the pointer is over the track, a bubble shows the percentage at that position. Its appearance is controlled by hover-width, hover-height, hover-font-size and hover-percent; the handle adopts hover-color.

Keyboard ​

↑ ↓ (and ← →) step by keyboard-step; Home/End jump to 0/1.