ki-slider
@kimen/elements/ki-slider- Source
- Agent reference
Use ki-slider for approximate values such as volume, exposure or a price
filter. Use a number input for exact entry and a radio group for a few named
choices.
<ki-slider label="Volume" name="volume" value="60" marks="5" format="percent"></ki-slider><ki-slider label="Price per night" name="price" range value="20,80" format="currency" currency="EUR"></ki-slider>Use centered to fill from the midpoint and show a center tick on a
single-thumb scale. Set orientation="vertical" to increase from bottom to
top. Horizontal scales follow the enclosing writing direction.
<ki-slider label="Exposure" centered min="-50" max="50" value="-20"></ki-slider><ki-slider label="Bass" orientation="vertical" max="10" value="4"></ki-slider>Keyboard and forms
Tab reaches each thumb in order. The arrows move one step, Page Up and Page Down move ten, and Home and End reach the focused thumb’s current limits. Horizontal arrows follow the scale’s direction. Up always increases.
Provide a specific label and use help-text for extra context. Use
minimum-label and maximum-label to localize the range thumb suffixes.
format changes the readout and the accessible value. A value of 60
displays as 60% in percent format.
Each named slider submits one form entry. The range above submits 20,80.
Reset restores the initial selection. Listen for input to preview changes
and change to act after a pointer release or keyboard adjustment.
API reference
When to use: coarse adjustments such as volume, balance or a price filter, with a descriptive label.
When not to use: when people need to enter exact numbers or choose among a few named options. Use a number input or radio group for those tasks.
Properties & attributes
| Attribute | Property | Type | Default | Description |
|---|---|---|---|---|
centered | centered | boolean | false | Shows a midpoint tick and fills from that point to a single thumb. |
currency | currency | string | 'EUR' | ISO 4217 code used with currency format. |
disabled | disabled | boolean | false | Makes the slider unavailable for pointer, keyboard and form submission. |
format | format | "currency" | "number" | "percent" | 'number' | Display format for the readout and accessible values. |
help-text | helpText | string | undefined | – | Optional supporting text, read as the description of each thumb. |
label | label | string | undefined | 'Slider' | Visible base name. Use a task-specific, localized label. |
marks | marks | number | 0 | Number of evenly spaced tick intervals, up to 100. Zero hides ticks. |
max | max | number | 100 | Inclusive upper bound. A maximum below min collapses the scale. |
maximum-label | maximumLabel | string | undefined | 'maximum' | Localized suffix for the upper thumb's accessible name. |
min | min | number | 0 | Inclusive lower bound and step origin. |
minimum-label | minimumLabel | string | undefined | 'minimum' | Localized suffix for the lower thumb's accessible name. |
name | name | string | undefined | – | Native form key. Omit when the value should remain local to the control. |
orientation | orientation | "horizontal" | "vertical" | 'horizontal' | Axis of the scale. A vertical scale increases towards the top. |
range | range | boolean | false | Enables two non-crossing thumbs in minimum then maximum tab order. |
step | step | number | 1 | Positive increment. Values snap from min and max is always reachable. |
value | value | number | string | undefined | – | Current selection as a number or, in range mode, a comma-separated pair. HTML attributes also accept the scalar as numeric text. Defaults to min for one thumb and to both bounds for a range. User updates are normalized. |
Events
| Event | Detail type | Description |
|---|---|---|
change | Event | Bubbles once when a pointer operation commits a different selection or a keyboard action changes it. Read the current host value. For updates during a drag, listen for the standard bubbling input event. Programmatic updates and form resets are silent. |
CSS parts
| Part | Description |
|---|---|
center-tick | Midpoint mark on a centered scale. |
field | Layout containing the visible label, value, controls and help. |
fill | Active portion of the rail. |
help | Supporting text associated with each thumb. |
label | Visible text used to name the control. |
mark | Decorative scale mark at an interval boundary. |
thumb | Focusable pointer target for one end of the selection. |
track | Inactive rail between the two ends of the scale. |
value | Formatted value or interval shown beside the label. |
CSS custom properties
The public styling contract of ki-slider: reassign these tokens at :root or on a subtree — never override internals.
| Token | Description |
|---|---|
--ki-density-target-min | The smallest pointer target any density may produce: 24 x 24 CSS px by default and in compact (WCAG 2.5.8 AA), 44 x 44 in touch (WCAG 2.5.5). It floors a shrinking control but never lifts what a control paints: a control painted smaller extends its target to it, invisibly; rows and tabs grow to it (spec 045 A1). |
--ki-focus-ring-color | Colour of the keyboard focus ring every focusable component draws: 3:1 or more against the page in every theme and scheme. |
--ki-focus-ring-offset | Gap between a focusable component and its keyboard focus ring. |
--ki-focus-ring-width | Thickness of the keyboard focus ring every focusable component draws (its outline). One token instead of one per component, so a mode or a theme changes every ring at once. |
--ki-slider-coarse-target | Minimum target size on a coarse pointer. |
--ki-slider-fill-backdrop-filter | Optional effect behind the active rail. |
--ki-slider-fill-bg | Colour of the active section of the rail. |
--ki-slider-fill-bg-image | Optional image painted on the active rail. |
--ki-slider-gap | Gap between the slider control and its labels. |
--ki-slider-label-bg | Background beneath the field label. |
--ki-slider-label-fg | Ink of the field label. |
--ki-slider-mark-width | Thickness of each interval tick. |
--ki-slider-radius | Round rail, grip and midpoint tick corners. |
--ki-slider-text-bg | Background beneath the value readout and help. |
--ki-slider-text-fg | Ink of the value readout and help. |
--ki-slider-thumb-backdrop-filter | Optional effect behind the grip. |
--ki-slider-thumb-bg | Grip surface behind the outline. |
--ki-slider-thumb-bg-image | Optional image painted on the grip. |
--ki-slider-thumb-border | Outline colour of the visible grip. |
--ki-slider-thumb-border-width | Outline thickness of the visible grip. |
--ki-slider-thumb-shadow | Optional grip elevation. |
--ki-slider-thumb-size | Diameter of the visible grip within the pointer target. |
--ki-slider-track-backdrop-filter | Optional effect behind the inactive rail. |
--ki-slider-track-bg | Inactive rail colour against the surrounding surface. |
--ki-slider-track-bg-image | Optional image painted on the inactive rail. |
--ki-slider-track-height | Inactive rail thickness. |
--ki-slider-vertical-length | Length of the vertical rail. |
--ki-typography-family-body | semantic font family for typography family body. |
--ki-typography-line-height-body-1 | semantic dimension for typography line height body 1. |
--ki-typography-line-height-caption-2 | semantic dimension for typography line height caption 2. |
--ki-typography-size-body-1 | semantic dimension for typography size body 1. |
--ki-typography-size-caption-2 | semantic dimension for typography size caption 2. |
--ki-typography-weight-body-medium | semantic font weight for typography weight body medium. |