RepeatButton
RepatButton provides press-and-hold functionality and it is an ideal UI component for allowing end-users to control an increasing or decreasing value.
Selector
smart-repeat-button
Properties
Events
Properties
animation"none" | "simple" | "advanced"
Sets or gets the animation mode. Animation is disabled when the property is set to 'none'
Allowed Values
- "none" - animation is disabled
- "simple" - ripple animation is disabled
- "advanced" - all animations are enabled
Default value
"advanced"Example
Set the animation property.
<smart-repeat-button animation='none'></smart-repeat-button>
Set the animation property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.animation = 'simple';
Get the animation property.
const repeatbutton = document.querySelector('smart-repeat-button');
let animation = repeatbutton.animation;
clickMode"hover" | "press" | "release" | "pressAndRelease"
Sets the click mode of the button.
Default value
"release"Example
Set the clickMode property.
<smart-repeat-button click-mode='hover'></smart-repeat-button>
Set the clickMode property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.clickMode = 'release';
Get the clickMode property.
const repeatbutton = document.querySelector('smart-repeat-button');
let clickMode = repeatbutton.clickMode;
delaynumber
Sets the delay between repeats in miliseconds.
Default value
50Example
Set the delay property.
<smart-repeat-button delay='20'></smart-repeat-button>
Set the delay property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.delay = 100;
Get the delay property.
const repeatbutton = document.querySelector('smart-repeat-button');
let delay = repeatbutton.delay;
disabledboolean
Enables or disables the ratio button.
Default value
falseExample
Set the disabled property.
<smart-repeat-button disabled></smart-repeat-button>
Set the disabled property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.disabled = false;
Get the disabled property.
const repeatbutton = document.querySelector('smart-repeat-button');
let disabled = repeatbutton.disabled;
initialDelaynumber
Sets a delay before the first repeat iteration in miliseconds.
Default value
150Example
Set the initialDelay property.
<smart-repeat-button initial-delay='50'></smart-repeat-button>
Set the initialDelay property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.initialDelay = 500;
Get the initialDelay property.
const repeatbutton = document.querySelector('smart-repeat-button');
let initialDelay = repeatbutton.initialDelay;
innerHTMLstring
Sets the inner HTML of the element.
Default value
""""Example
Set the innerHTML property.
<smart-repeat-button inner-h-t-m-l='Repeat Button Label'></smart-repeat-button>
Set the innerHTML property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.innerHTML = 'New Repeat Button Label';
Get the innerHTML property.
const repeatbutton = document.querySelector('smart-repeat-button');
let innerHTML = repeatbutton.innerHTML;
localestring
Sets or gets the language. Used in conjunction with the property messages.
Default value
"en"Example
Set the locale property.
<smart-repeat-button locale='de'></smart-repeat-button>
Set the locale property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.locale = 'fr';
Get the locale property.
const repeatbutton = document.querySelector('smart-repeat-button');
let locale = repeatbutton.locale;
localizeFormatFunctionfunction | null
Callback, related to localization module.
Example
Set the localizeFormatFunction property.
<smart-repeat-button localize-format-function='function(){return '...'}'></smart-repeat-button>
Set the localizeFormatFunction property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.localizeFormatFunction = function(){return '...'};
Get the localizeFormatFunction property.
const repeatbutton = document.querySelector('smart-repeat-button');
let localizeFormatFunction = repeatbutton.localizeFormatFunction;
messagesobject
Sets an object with string values, related to the different states of passwords strength.
Default value
"en": {
"propertyUnknownType": "'{{name}}' property is with undefined 'type' member!",
"propertyInvalidValue": "Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!",
"propertyInvalidValueType": "Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!",
"elementNotInDOM": "Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.",
"moduleUndefined": "Module is undefined.",
"missingReference": "{{elementType}}: Missing reference to {{files}}.",
"htmlTemplateNotSuported": "{{elementType}}: Browser doesn't support HTMLTemplate elements.",
"invalidTemplate": "{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM."
}
Example
Set the messages property.
<smart-repeat-button messages='{"de":{"propertyUnknownType":"Die Eigenschaft '{{name}}' hat ein nicht definiertes 'type'-Member!","propertyInvalidValue":"Ungultiger Eigenschaftswert '{{name}}'! Aktueller Wert: {{actualValue}}, Erwarteter Wert: {{value}}!","propertyInvalidValueType":"Ungultiger Eigenschaftswert '{{name}}'! Aktueller Wert: {{actualType}}, Erwarteter Wert: {{type}}!","elementNotInDOM":"Element existiert nicht in DOM! Bitte fugen Sie das Element zum DOM hinzu, bevor Sie eine Methode aufrufen.","moduleUndefined":"Modul ist nicht definiert.","missingReference":"{{elementType}}: Fehlender Verweis auf {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser unterstutzt keine HTMLTemplate-Elemente.","invalidTemplate":"{{elementType}}: '{{property}}' Die Eigenschaft akzeptiert eine Zeichenfolge, die mit der ID eines HTMLTemplate-Elements aus dem DOM ubereinstimmen muss."}}'></smart-repeat-button>
Set the messages property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.messages = {"en":{"propertyUnknownType":"'{{name}}' property is with undefined 'type' member!","propertyInvalidValue":"Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!","propertyInvalidValueType":"Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!","elementNotInDOM":"Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.","moduleUndefined":"Module is undefined.","missingReference":"{{elementType}}: Missing reference to {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser doesn't support HTMLTemplate elements.","invalidTemplate":"{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM."}};
Get the messages property.
const repeatbutton = document.querySelector('smart-repeat-button');
let messages = repeatbutton.messages;
namestring
Sets or gets the widget's name.
Default value
""""Example
Set the name property.
<smart-repeat-button name='Name'></smart-repeat-button>
Set the name property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.name = 'New Name';
Get the name property.
const repeatbutton = document.querySelector('smart-repeat-button');
let name = repeatbutton.name;
readonlyboolean
If the custom element is readonly, it cannot be interacted with.
Default value
falseExample
Set the readonly property.
<smart-repeat-button readonly></smart-repeat-button>
Set the readonly property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.readonly = false;
Get the readonly property.
const repeatbutton = document.querySelector('smart-repeat-button');
let readonly = repeatbutton.readonly;
themestring
Determines the theme. Theme defines the look of the element
Default value
""Example
Set the theme property.
<smart-repeat-button theme='blue'></smart-repeat-button>
Set the theme property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.theme = 'red';
Get the theme property.
const repeatbutton = document.querySelector('smart-repeat-button');
let theme = repeatbutton.theme;
unfocusableboolean
If is set to true, the element cannot be focused.
Default value
falseExample
Set the unfocusable property.
<smart-repeat-button unfocusable></smart-repeat-button>
Set the unfocusable property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.unfocusable = false;
Get the unfocusable property.
const repeatbutton = document.querySelector('smart-repeat-button');
let unfocusable = repeatbutton.unfocusable;
valuestring
Sets or gets the widget's value.
Default value
""""Example
Set the value property.
<smart-repeat-button value='Value'></smart-repeat-button>
Set the value property by using the HTML Element's instance.
const repeatbutton = document.querySelector('smart-repeat-button');
repeatbutton.value = 'New Value';
Get the value property.
const repeatbutton = document.querySelector('smart-repeat-button');
let value = repeatbutton.value;
Events
clickCustomEvent
This event is triggered when the element is clicked.
- Bubbles Yes
- Cancelable No
- Interface CustomEvent
- Event handler property onClick
Arguments
evCustomEvent
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Example
Set up the event handler of click event.
const repeatbutton = document.querySelector('smart-repeat-button'); repeatbutton.addEventListener('click', function (event) { // event handling code goes here. })