The slider lets the user drag out a value within a continuous range (volume, brightness, font size, price range…). The style and feel reproduce WinUI 3 (Windows App SDK) Slider, and the interaction base reuses the reka-ui Slider: pointer dragging, snap-to-step, Home / End / arrow keys / PageUp / PageDown keyboard operation, role="slider" semantics, and form submission are all handled by the base, while this component is responsible for landing WinUI's geometry and states item by item.
All geometry comes from WinUI original values: the control is 32px tall (SliderPreContentMargin 14 + track 4 + SliderPostContentMargin 14), the track is 4px thick with a 2px corner radius, and the 18×18 layout box of the thumb is stretched out by a Margin=-2 into a 22×22 visual outer ring (a perfect circle, whose radius converges to half its width), with a 12px inner dot.
Pointer interaction likewise aligns with WinUI: pressing on the thumb (the whole visible 22×22 outer ring counts) merely 「grabs」 the thumb without changing the value; pressing on the track outside the thumb moves the thumb's center to the pointer and jumps the value (MoveThumbToPoint).
v-model binds the numeric value, and min / max / step determine the range and step size (default 0–100, step 1); header is the WinUI title row and also serves as the default accessible name.
Volume: 45 · Brightness: 80
Use header or the #header slot for the top title. When holding the thumb (or when it has keyboard focus), a WinUI value tooltip (Disambiguation UI) floats above the thumb: the text is formatted with the decimal places of step, up to 4; passing tooltip="false" corresponds to IsThumbToolTipEnabled=false.
While holding the thumb (or when it has keyboard focus), a WinUI value tooltip (Disambiguation UI) floats above the thumb.
The arrow keys move one step at a time, PageUp / PageDown or Shift + arrow keys jump 10 steps, and Home / End go straight to either end; while dragging, the value snaps to step and is clamped within [min, max].
¥250 · 0.4× — arrow keys move by step; PageUp / PageDown or Shift + arrow keys jump 10 steps.
orientation="vertical" switches to vertical: the value increases bottom-up (consistent with WinUI, the minimum is at the bottom); pass inverted to reverse. The vertical height is controlled by verticalLength (default 200px).
Values increase from bottom to top on a vertical slider (same as WinUI: the minimum is at the bottom); pass inverted to reverse it.
tickPlacement corresponds to the WinUI TickPlacement: none (default) / inline (inside the track) / outside (both sides of the track) / top-left / bottom-right (one side, which is left / right when vertical). Consistent with WinUI, no tick lines are drawn when tickFrequency is 0 (the default).
Same as WinUI: no tick lines are drawn when `tickFrequency` is 0 (the default).
When disabled, it is not interactive, and the track, the value fill, the thumb, and the title all fall to the …Disabled tier; the inner dot stops at the WinUI Disabled-state size of 14px.
When disabled, the track, value fill, thumb and title all fall to the …Disabled tier; the thumb moves to the …Disabled size (the inner dot grows to 14px in WinUI's Disabled state).
When inside a <form> with name passed, a hidden native <input type="hidden"> is added, submitting name=value.
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue | number | — | Current value (v-model); when omitted, falls back to defaultValue (uncontrolled) |
defaultValue | number | min | Uncontrolled initial value |
min / max | number | 0 / 100 | Range (WinUI RangeBase.Minimum / Maximum) |
step | number | 1 | Step size (WinUI StepFrequency) |
disabled | boolean | false | Whether disabled |
orientation | 'horizontal' | 'vertical' | 'horizontal' | Orientation |
inverted | boolean | false | Reversed (WinUI IsDirectionReversed) |
header | string | — | Top title (WinUI Header), also the default accessible name |
label | string | — | Accessible name (takes precedence over header) |
name | string | — | Form submission name, paired with a hidden native input |
tooltip | boolean | true | Value tooltip (WinUI IsThumbToolTipEnabled) |
tickPlacement | 'none' | 'inline' | 'outside' | 'top-left' | 'bottom-right' | 'none' | Tick position (WinUI TickPlacement) |
tickFrequency | number | 0 | Tick interval (WinUI TickFrequency), 0 = not drawn |
verticalLength | number | 200 | Control length when vertical (px) |
dir | 'ltr' | 'rtl' | — | Reading direction |
| Event | Payload | Description |
|---|---|---|
update:modelValue | number | Value changed (v-model) |
valueCommit | number | Final value at the end of an interaction |
| Slot | Description |
|---|---|
header | Top title row (WinUI Header) |
State colors cross-reference
Slider_themeresources.xaml: the track isControlStrongFillColorDefault(same on hover / pressed), the value fill isAccentFillColorDefault→Secondary→Tertiary, the thumb's outer ring isControlSolidFillColorDefault+ControlElevationBorderBrush, and the inner dot scales at0.86/1.167/0.71(Disabled stops at1.167). The focus ring follows this repo's unified Fluent spec (strokeWidthThick+colorCompoundBrandStroke), which is a different way of landing the same intent as WinUI's two-colorFocusVisualMargin=-7,0rect.