▾
import "@arcgis/common-components/components/arcgis-value-picker-slider";- Inheritance
- ArcgisValuePickerSlider→
HTMLElement
Demo
Properties
| Property | Attribute | Type |
|---|---|---|
| auto-destroy-disabled | ||
| can-next | ||
| can-play | ||
| can-previous | ||
| current-value | ||
| disabled | ||
| | ||
| | ||
| reflected | layout | |
| | ||
| max | ||
| min | ||
| | ||
| mirrored | ||
| |
autoDestroyDisabled
- Type
- boolean
If true, the component will not be destroyed automatically when it is disconnected from the document. This is useful when you want to move the component to a different place on the page, or temporarily hide it. If this is set, make sure to call the destroy() method when you are done to prevent memory leaks.
- Attribute
- auto-destroy-disabled
- Default value
- false
canNext
- Type
- boolean
Determines whether the user can interact with the next button.
This property is automatically set to false when the index of currentValue matches the last index of
steps, or the first index if mirrored is true.
- Attribute
- can-next
- Default value
- false
- Example
- const valuePicker = document.querySelector("arcgis-value-picker");const valuePickerSlider = document.querySelector("arcgis-value-picker-slider");valuePickerSlider.steps = [1, 2, 3];valuePickerSlider.currentValue = 3;if (valuePickerSlider.canNext) {valuePicker.next();} else {console.log("Cannot step forward."); // this line will execute}
canPlay
- Type
- boolean
Determines whether the user can interact with the play/pause button.
- Attribute
- can-play
- Default value
- false
canPrevious
- Type
- boolean
Determines whether the user can interact with the previous button.
This property is automatically set to false when the index of currentValue matches the first index of
steps, or the last index if mirrored is true.
- Attribute
- can-previous
- Default value
- false
- Example
- const valuePicker = document.querySelector("arcgis-value-picker");const valuePickerSlider = document.querySelector("arcgis-value-picker-slider");// `steps` will be rendered on a vertical track where "3" is the topmost value.// The previous button (pointing down) will fail to decrement the index of `steps` by 1.valuePickerSlider.steps = [1, 2, 3];valuePickerSlider.currentValue = 1;valuePickerSlider.mirrored = false;valuePicker.layout = "vertical";if (valuePickerSlider.canPrevious) {valuePicker.previous();} else {console.log("Cannot step backward."); // this line will execute}
disabled
- Type
- boolean
When set to true, the user may not interact with the slider.
Note that if the ValuePicker's arcgis-value-picker.disabled property is mutated, this property will update to match it.
- Attribute
- disabled
- Default value
- false
labelFormatter
A function used to format labels. Overrides the default label formatter.
- Example
- // Display a label at every step formatted as a percentage.const valuePickerSlider = document.querySelector("arcgis-value-picker-slider");valuePickerSlider.steps = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100];valuePickerSlider.labels = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100];valuePickerSlider.labelFormatter = (value) => `${value}%`;
labels
Determines where along the slider track labels should be placed. Labels will be formatted by the labelFormatter property.
- Example
- // Display a label at every other stepconst valuePickerSlider = document.querySelector("arcgis-value-picker-slider");valuePickerSlider.steps = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100];valuePickerSlider.labels = [0, 20, 40, 60, 80, 100];
layout
Determines whether the slider should be oriented horizontally or vertically. Note that if arcgis-value-picker.layout on the Value Picker component is mutated, this property will update to match it. If you wish for the slider to be visually mirrored, set the mirrored property to true.
- See also
- Attribute
- layout
- Default value
- "horizontal"
- Example
- // Display a vertical slider with `steps` ascending bottom to top. In this instance, the 'previous'// button (pointing downwards) will bring `currentValue` closer to 0 to match the slider's appearance.const valuePickerSlider = document.querySelector("arcgis-value-picker-slider");valuePickerSlider.steps = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100];valuePickerSlider.currentValue = 100;valuePickerSlider.layout = "vertical";// Display a horizontal slider with `steps` ascending right to left. Since `mirrored` is true,// the slider will show `currentValue` decreasing from 100 to 0 as the 'next' button (pointing to the right) is pressed.const valuePickerSlider = document.querySelector("arcgis-value-picker-slider");valuePickerSlider.steps = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100];valuePickerSlider.currentValue = 100;valuePickerSlider.layout = "horizontal";valuePickerSlider.mirrored = true;
mirrored
- Type
- boolean
When true, the slider will display values increasing from right to left, or top to bottom,
depending on the value of layout. This inverts the direction of the slider,
where pressing the 'next' button will traverse the steps array in reverse order.
- Attribute
- mirrored
- Default value
- false
Methods
| Method | Signature |
|---|---|
| inherited | componentOnReady(): Promise<this> |
| destroy(): Promise<void> |
componentOnReady
- Signature
-
componentOnReady (): Promise<this>
Creates a promise that resolves once the component is fully loaded.
- Returns
- Promise<this>
- Example
- const arcgisValuePickerSlider = document.createElement("arcgis-value-picker-slider");document.body.append(arcgisValuePickerSlider);await arcgisValuePickerSlider.componentOnReady();console.log("arcgis-value-picker-slider is ready to go!");
Events
| Name | Type |
|---|---|
| CustomEvent<{ name: "canNext" | "canPlay" | "canPrevious" | "currentValue"; }> |
arcgisPropertyChange
arcgisPropertyChange: CustomEvent<{ name: "canNext" | "canPlay" | "canPrevious" | "currentValue"; }>