@lattice-ui/slider currently single-thumb only
What It Is For
Use Slider for bounded numeric input when dragging or key-based adjustment is more natural than typing a raw number.
It is a headless primitive for one-dimensional range selection rather than a styled media scrubber.
import { Slider } from "@lattice-ui/slider";
import React from "@rbxts/react";
export function SliderExample() {
const [value, setValue] = React.useState(42);
return (
<frame BackgroundTransparency={1} Size={UDim2.fromOffset(420, 160)}>
<Slider.Root
max={100}
min={0}
onValueChange={setValue}
step={1}
value={value}
>
<Slider.Track asChild>
<frame
BackgroundColor3={Color3.fromRGB(34, 41, 54)}
BorderSizePixel={0}
Position={UDim2.fromOffset(0, 24)}
Size={UDim2.fromOffset(320, 12)}
>
<uicorner CornerRadius={new UDim(0, 6)} />
<Slider.Range asChild>
<frame
BackgroundColor3={Color3.fromRGB(53, 104, 196)}
BorderSizePixel={0}
>
<uicorner CornerRadius={new UDim(0, 6)} />
</frame>
</Slider.Range>
<Slider.Thumb asChild>
<textbutton
AutoButtonColor={false}
BackgroundColor3={Color3.fromRGB(240, 244, 250)}
BorderSizePixel={0}
Size={UDim2.fromOffset(18, 18)}
Text=""
>
<uicorner CornerRadius={new UDim(1, 0)} />
</textbutton>
</Slider.Thumb>
</frame>
</Slider.Track>
</Slider.Root>
<textlabel
BackgroundTransparency={1}
Position={UDim2.fromOffset(0, 56)}
Size={UDim2.fromOffset(320, 20)}
Text={`Value: ${math.floor(value)}`}
TextColor3={Color3.fromRGB(172, 181, 196)}
TextSize={13}
TextXAlignment={Enum.TextXAlignment.Left}
/>
</frame>
);
} Live demo is experimental and may contain bugs.
Install
Global CLI command: lattice add slider
Monorepo local script
Use your package manager wrapper when running the local lattice command.
pnpm lattice add sliderPublic Exports
-
Slider -
Slider.Root -
Slider.Track -
Slider.Range -
Slider.Thumb
State Model
Slider.Rootmanages controlled or uncontrolled numericvalueplus a separate commit callback for final confirmation.min,max,step,orientation, anddisableddefine how movement maps to values.- Track and thumb hosts are registered into shared slider state so drag calculations know which geometry to use.
Key API
Slider.Root
Use value, defaultValue, onValueChange, onValueCommit, min, max, step, and orientation to define the numeric model.
Slider.Track
Bind your main drag surface here so the slider can translate pointer position into values.
Slider.Range / Slider.Thumb
Use these for the filled segment and the draggable handle without reimplementing range math.
Composition Patterns
Audio or gameplay settings
Use a horizontal slider with a separate numeric label when the user benefits from both direct manipulation and explicit value feedback.
Vertical scrubbing surfaces
Use orientation="vertical" for compact inspector-style controls or side-mounted adjustment strips.
Cautions / Limits
- The current public package is single-thumb only; it is not a dual-handle range selector.
- Values are clamped and stepped by the package, so do not depend on raw pointer positions as authoritative state.
- Use
motionfor thumb and range response; slider state should stay value-driven rather than animation-driven.