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 |
The disabled state of the slider. | true | false |
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 |
The disabled state of the slider. | true | false |
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 |
The disabled state of the slider. | true | false |
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 |
The disabled state of the slider. | true | false |
data-hover |
The hover state of the slider thumb. | true | false |
data-focus-visible |
The focus state of the slider thumb. | true | false |
data-press |
The pressed state of the slider thumb. | true | false |
Adheres to the Slider WAI-ARIA design pattern.
Copyright © 2024 Angular Primitives