Slider
An input where the user selects a value from within a given range.
<NaviusSlider @bind-Value="_value" Min="0" Max="100" Step="1"
class="relative flex h-5 w-full items-center">
<NaviusSliderTrack class="relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted">
<NaviusSliderRange class="bg-primary" />
</NaviusSliderTrack>
<NaviusSliderThumb class="block h-5 w-5 rounded-full border border-primary/60 bg-background
focus-visible:ring-2 focus-visible:ring-ring" />
</NaviusSlider>
@code { private IReadOnlyList<double> _value = new double[] { 60 }; }Features
- Can be controlled (
@bind-Value) or uncontrolled (DefaultValue). - Supports multiple thumbs: add more than one
NaviusSliderThumbfor a range. - Supports a custom
Step,Min/MaxandMinStepsBetweenThumbs. - Horizontal or vertical orientation, with optional
Inverteddirection and RTL support. - Full keyboard navigation; the thumb is
role="slider"with the correctaria-value*state. - Renders a hidden number input per thumb (when
Nameis set) for native form submission.
Installation
Reference the Navius.Primitives package for the headless primitive, or vendor a styled version with the CLI: navius add copies the styled zits/ui component plus the brain files it depends on.
navius add sliderAnatomy
Import the parts and assemble them.
@using Navius.Primitives.Components.Slider
<NaviusSlider>
<NaviusSliderTrack>
<NaviusSliderRange />
</NaviusSliderTrack>
<NaviusSliderThumb />
</NaviusSlider>API Reference
Root
Contains all the parts of a slider. Owns the value array and cascades it to the parts. Renders a span.
| Prop | Type | Default |
|---|---|---|
| Value | IReadOnlyList<double>? | - |
| ValueChanged | EventCallback<IReadOnlyList<double>> | - |
| DefaultValue | IReadOnlyList<double>? | - |
| ValueCommitted | EventCallback<IReadOnlyList<double>> | - |
| Min | double | 0 |
| Max | double | 100 |
| Step | double | 1 |
| MinStepsBetweenThumbs | int | 0 |
| LargeStep | double | 0 |
| Orientation | string | "horizontal" |
| Inverted | bool | false |
| Dir | string? | - |
| Disabled | bool | false |
| Name | string? | - |
| Form | string? | - |
| ChildContent | RenderFragment? | - |
Data attributes
| Data attribute | Values |
|---|---|
| [data-orientation] | "horizontal" | "vertical" |
| [data-disabled] | Present when disabled |
Track
The rail the range fills and the thumb travels along. Renders a span.
| Prop | Type | Default |
|---|---|---|
| ChildContent | RenderFragment? | - |
Data attributes
| Data attribute | Values |
|---|---|
| [data-orientation] | "horizontal" | "vertical" |
| [data-disabled] | Present when disabled |
Range
The filled portion of the track between the lowest and highest thumb. Renders a span (absolutely positioned).
| Prop | Type | Default |
|---|---|---|
| - | - | - |
Data attributes
| Data attribute | Values |
|---|---|
| [data-orientation] | "horizontal" | "vertical" |
| [data-disabled] | Present when disabled |
Thumb
A draggable handle and the accessibility surface (role=slider). Add one per value. Renders a span (absolutely positioned).
| Prop | Type | Default |
|---|---|---|
| ChildContent | RenderFragment? | - |
Data attributes
| Data attribute | Values |
|---|---|
| [data-orientation] | "horizontal" | "vertical" |
| [data-disabled] | Present when disabled |
Accessibility
Implements the slider WAI-ARIA APG pattern: each thumb exposes aria-valuemin, aria-valuemax, aria-valuenow and aria-orientation; the bounds narrow to the neighbouring thumbs on a multi-thumb slider. Behavior is covered by the browser test suite and an axe-core WCAG gate in CI.
When the slider has no visible label, give each NaviusSliderThumb an aria-label (or aria-labelledby) so assistive technology can announce what it controls.
Keyboard interactions
| Key | Description |
|---|---|
| ArrowRight | Increments the value by Step (flips under RTL / Inverted). |
| ArrowLeft | Decrements the value by Step (flips under RTL / Inverted). |
| ArrowUp | Increments the value by Step. |
| ArrowDown | Decrements the value by Step. |
| Shift + Arrow | Increments / decrements by the large step. |
| PageUp | Increments the value by the large step. |
| PageDown | Decrements the value by the large step. |
| Home | Sets the value to Min. |
| End | Sets the value to Max. |