TComponents. VarSlider

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:
NameTypeDescription
parentHTMLElement

HTML element that is going to be the parent of the component

propsTComponents.VarSliderProps
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
Example
const slider = new TComponents.VarSlider(document.body,{
 position: 'absolute',
  zIndex: 1000,
});

// Render the component.
slider.render();

// Set the text.
slider.text = 20;

Methods

(protected) afterRenderOnce() → {void}

there are something need to do after render once

Returns:
Type: 
void

checkValueInRange(value) → {number}

Check if the value is in the range of min and max

Parameters:
NameTypeDescription
valuenumber

The value to be checked

Returns:
  • The valid value within the range
Type: 
number

(protected) defaultProps() → {TComponents.VarSliderProps}

Returns the default values of class properties (excluding parent properties).

markup() → {string}

Generates the markup for the slider component.

Returns:

HTML markup string

Type: 
string

onRender() → {void}

Renders the slider component.

Throws:

Throws an error if rendering fails.

Type
Error
Returns:
Type: 
void

(static) loadCssClassFromString(css) → {void}

Add css properties to the component

Parameters:
NameTypeDescription
cssstring

The css string to be loaded into style tag

Returns:
Type: 
void
Example
TComponents.VarSlider.loadCssClassFromString(`
.tc-var-slider {
  height: inherit;
 }`
);