new VarSlider(parent, props)
Slider element. Additional callbacks can be added with the onChange method. This class focuses on the specific properties of the SliderVar component. Since it inherits from Accessor_A, all basic properties (e.g., height, width) are available but documented in the Accessor_A part.
Parameters:
| Name | Type | Description |
|---|---|---|
parent | HTMLElement | HTML element that is going to be the parent of the component |
props | TComponents. |
- Source
Example
const slider = new TComponents.VarSlider(document.body,{
position: 'absolute',
zIndex: 1000,
});
// Render the component.
slider.render();Extends
Members
text :number
Set current text value
Type:
- number
- Source
const slider = new TComponents.VarSlider(document.body,{
position: 'absolute',
zIndex: 1000,
});
// Render the component.
slider.render();
// Set the text.
slider.text = 20;Methods
checkValueInRange(value) → {number}
Check if the value is in the range of min and max
Parameters:
| Name | Type | Description |
|---|---|---|
value | number | The value to be checked |
- Source
Returns:
- The valid value within the range
- Type:
- number
(protected) defaultProps() → {TComponents.VarSliderProps}
Returns the default values of class properties (excluding parent properties).
- Overrides
- Source
Returns:
markup() → {string}
Generates the markup for the slider component.
- Overrides
- Source
Returns:
HTML markup string
- Type:
- string
onRender() → {void}
Renders the slider component.
- Overrides
- Source
Throws:
Throws an error if rendering fails.
- Type
- Error
Returns:
- Type:
- void
(static) loadCssClassFromString(css) → {void}
Add css properties to the component
Parameters:
| Name | Type | Description |
|---|---|---|
css | string | The css string to be loaded into style tag |
- Source
Returns:
- Type:
- void
Example
TComponents.VarSlider.loadCssClassFromString(`
.tc-var-slider {
height: inherit;
}`
);