Slider: the set value to its step's decimals; the reading marked on the track and on the ring; mark geometry in the docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Melvin Strobl
2026-10-14 16:00:53 +02:00
co-authored by Claude Opus 5.5
parent a6a1f2a2c3
commit 5b2769c141
11 changed files with 141 additions and 14 deletions
@@ -105,7 +105,7 @@ export function Switch(props: SwitchProps) {
}
export function Slider(props: SliderProps) {
const { fraction, inputProps, marks, trackRef } = useSliderDrag(props)
const { fraction, inputProps, marks, markAt, trackRef } = useSliderDrag(props)
const orientation = props.orientation ?? "horizontal"
return (
<div
@@ -125,6 +125,15 @@ export function Slider(props: SliderProps) {
the keyboard, the pointer and every `aria-`, and owes the look
nothing. */}
<input {...inputProps} className="dui-slider-input" />
{/* Under the handle, so where the two meet the value being set wins;
after the input only for its `:disabled`, as it takes no pointer. */}
{markAt === null ? null : (
<span
className="dui-slider-mark"
aria-hidden
style={{ "--dui-mark": markAt } as React.CSSProperties}
/>
)}
<span className="dui-slider-thumb" aria-hidden />
</div>
{marks.length > 0 ? (