UI Slider

Adds a bar you drag to set a value, for example how strong an effect is. The bar is horizontal, and you choose its size and colors.

Games & Interactivity

Game engines, physics, quizzes, leaderboards, and the UI controls that tie it together.

Made with this block

Inputs

heightfloat

Thickness of the slider bar in screen units. Recommended range 0.02–0.1. 0.05 is a clean thin bar; 0.06–0.15 is chunky/bold. Keep below 0.1 so it still reads as a slider, not a button.

widthfloat

Length of the slider in screen space units. Recommended range (0.6–1.8). 1.8 = full screen width; 1.4–1.6 for inset sliders; smaller for compact controls.

positionvec2

Screen-space position of the slider's center (0.0 to 1.0). - Center: [0.5, 0.5] - Near bottom (typical): [0.5, 0.85] - Near top: [0.5, 0.15]

thumbSizefloat

Multiplier on the thumb's base size. Range 1.0–5.0. 1.0 = compact, 2.0 = comfortable touch target (mobile default), 2.5+ = chunky/playful.

barColorvec4

Color of the inactive track (not yet filled). Each channel 0–1. Use a low-saturation neutral so the active fill and thumb pop. Translucent alpha (w < 1) for subtle/secondary looks.

trackBarColorvec4

Color of the active fill — the portion between the start/center and the thumb. Each channel 0–1. It is usually an accent color. Ignored when trackBarMode = 0.

thumbColorvec4

Color of the draggable thumb. Each channel 0–1. Must contrast with barColor. Often matches trackBarColor for a unified accent, or contrasts for emphasis.

trackBarModeint

Fill style of the active track. 0 = None (no fill, only the thumb moves — minimal/static). 1 = Start / "Progress" (fills from left edge to thumb — standard progress affordance, recommended default). 2 = Center / "Balanced" (fills outward from midpoint — for bipolar values like +/- intensity).

rotationfloat

Slider's rotation

Functions

getValuefloat

Returns slider's value.

setValuefloat

Set slider's value.