Skip to main content
Version: latest
Works everywhere

Slider works in both server and client environments. Always use the standard import (e.g. @prokodo/ui/slider) — the library detects the runtime automatically.

Slider

Slider renders an <input type="range"> styled with prokodo design tokens. Supports both single-thumb and dual-thumb range modes.

Live demo →

Overview

import { Slider } from "@prokodo/ui/slider"
;<Slider
name="volume"
label="Volume"
min={0}
max={100}
step={1}
value={volume}
onChange={setVolume}
/>

Import

import { Slider } from "@prokodo/ui/slider"

CSS:

import "@prokodo/ui/slider.css"

Props

PropTypeDefaultRequiredDescription
idstringHTML id for the slider (required for accessibility).
labelstringSlider label text.
valuenumber | stringControlled slider value.
defaultValuenumber | stringUncontrolled initial value.
minnumber0Minimum value.
maxnumber100Maximum value.
stepnumber1Step increment.
snapbooleanfalseSnap value to step increments.
marksboolean | SliderMark[]falseShow tick marks or custom marks.
disabledbooleanfalseDisable the slider.
requiredbooleanfalseMark field as required.
hideLabelbooleanfalseVisually hide the label.
labelPropsLabelPropsProps forwarded to the label.
valueLabelPropsobjectProps for the value label tooltip.
colorVariantsAccent color variant.
errorTextstringError message.
helperTextstringHelper text shown below.
onChange(value: number) => voidCalled on value change.
classNamestringCSS class on root element.

See src/components/slider/Slider.model.ts for the full SliderProps type.


Design Tokens

Customise Slider via CSS custom properties on :root or a scoped ancestor.

TokenDefaultDescription
--pk-slider-track-height4pxTrack height
--pk-slider-track-bgvar(--pk-color-border)Unfilled track colour
--pk-slider-fill-fromvar(--pk-color-brand)Fill gradient start
--pk-slider-fill-tovar(--pk-color-accent)Fill gradient end
--pk-slider-label-fgvar(--pk-color-fg)Label text colour
--pk-slider-thumb-size24pxThumb diameter
--pk-slider-thumb-bordervar(--pk-color-surface)Thumb border / halo
--pk-slider-tooltip-bgvar(--pk-color-fg)Tooltip background
--pk-slider-tooltip-fgvar(--pk-color-surface)Tooltip text colour
--pk-slider-timing150msAnimation duration

AIC Note

Use the standard import path in application code:

import { Slider } from "@prokodo/ui/slider"

No separate /client or /lazy import selection is required in consumer code.

AIC components also support a priority flag for critical above-the-fold elements. This is most visible on Image (native preloading via <link rel="preload"> for above-the-fold content).


WCAG 2.2 Status

CriterionNameStatusNote
1.3.1Info and Relationships (A)✅ FulfilledSemantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA.
1.4.1Use of Color (A)🔍 Manual reviewColor must not be the only means of conveying information (e.g. error states, required field markers).
2.1.1Keyboard (A)🔍 Manual reviewAll functionality must be operable via keyboard alone, without requiring specific timing.
2.4.7Focus Visible (AA)🔍 Manual reviewA visible keyboard focus indicator must be present on every interactive element. Verify against the applied product theme.
2.5.3Label in Name (A)✅ FulfilledFor components with a visible label, the accessible name must contain or match the visible label text.
3.3.2Labels or Instructions (A)✅ FulfilledEvery form input requires a programmatically associated label or a visible instruction.
4.1.2Name, Role, Value (A)✅ FulfilledName, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA.

Test coverage: 2 jest-axe assertion(s) across 5 test file(s) · 7 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open Slider in Storybook


Source

src/components/slider/Slider.model.ts