@cas-smartdesign/lit-slider
v7.3.0
Published
A slider element based on LitElement & material components
Readme
@cas-smartdesign/lit-slider
A slider element based on lit-element with SmartDesign look & feel.
Requirements
The main entry point requires ES6 & support for Custom Elements v1
Attributes
The following attributes are supported: min, max, value, step, editable, clampValue, inputSuffix, disabled & hidden
Properties
The following properties are available:
valuenumber (default=0)- reflects the corresponding attribute
minnumber (default=0)- reflects the corresponding attribute
maxnumber (default=1)- reflects the corresponding attribute
stepnumber (default=undefined)- Reflects the corresponding attribute, if undefined then the (max - min) / 100 value is used.
- Valid values are defined based on the
minvalue and increments of thestepvalue, up to themaxvalue. - If difference between
minandmaxis bigger than 1, only steps larger than 1 are supported on user interactions done directly on the slider part.
colorsMap<number, string> (default=empty)- A relative-value -> color mapping which can be used to configure a color blending mode for the slider. For further details check the examples.
editableboolean (default=false)- If set to true then a value
lit-inputis shown next to the track container.
- If set to true then a value
clampValueboolean (default=false)- If set to true, the value is clamped according to the limits of min and max.
inputSuffixstring (default=undefined)- A suffix text can be defined for the value field which is turned on via editable flag.
disabledboolean (default=false)- reflects the corresponding attribute
decimalSeparatorstring (default=".")- Used to convert numbers edited via the above mentioned input field.
Custom events
value-change- This event is dispatched when the value has been changed because of a user interaction
immediate-value-change- This event is dispatched continously during user interaction
Validation
The element could show validation messages via an sd-field-validation-message element which can be configured with the following attributes & properties which are all delegated to that:
validationMessagestring (default=undefined)validationIconSrcstring (default=undefined)validationLevelValidationLevel (warn, suggest & error) (default=undefined)
Other
It supports touch devices, uses aria attributes and includes the default keydown event handling such as arrow- left, top, right, bottom.
