Primitives
Select a value within a range.
Import the Slider primitives from ng-primitives/slider
.
import { NgpSlider, NgpSliderTrack, NgpSliderRange, NgpSliderThumb } from 'ng-primitives/slider';
Assemble the slider directives in your template.
<div ngpSlider>
<div ngpSliderTrack>
<div ngpSliderRange></div>
</div>
<div ngpSliderThumb></div>
</div>
Here are some additional examples of how to use the Slider primitives.
The slider automatically integrates with the form field primitives.
The following directives are available to import from the ng-primitives/slider
package:
Apply the ngpSlider
directive to an element that represents the slider and contains the track, range, and thumb.
[ngpSlider]
ngpSlider
The following data attributes are available to style the slider:
Attribute | Description | Value |
---|---|---|
data-disabled |
Applied when the slider is disabled. | - |
data-orientation |
The orientation of the slider. | horizontal | vertical |
Apply the ngpSliderTrack
directive to an element that represents the track of the slider.
[ngpSliderTrack]
ngpSliderTrack
The following data attributes are available to style the slider track:
Attribute | Description | Value |
---|---|---|
data-disabled |
Applied when the slider is disabled. | - |
data-orientation |
The orientation of the slider. | horizontal | vertical |
Apply the ngpSliderRange
directive to an element that represents the range of the slider.
[ngpSliderRange]
ngpSliderRange
The following data attributes are available to style the slider range:
Attribute | Description | Value |
---|---|---|
data-disabled |
Applied when the slider is disabled. | - |
data-orientation |
The orientation of the slider. | horizontal | vertical |
Apply the ngpSliderThumb
directive to an element that represents the thumb of the slider.
[ngpSliderThumb]
ngpSliderThumb
The following data attributes are available to style the thumb:
Attribute | Description | Value |
---|---|---|
data-orientation |
The orientation of the slider. | horizontal | vertical |
data-disabled |
Applied when the slider is disabled. | - |
data-hover |
Applied when the slider thumb is hovered. | - |
data-focus-visible |
Applied when the slider thumb is focused. | - |
data-press |
Applied when the slider thumb is pressed. | - |
Adheres to the Slider WAI-ARIA design pattern.
Copyright © 2024 Angular Primitives