Skip to main content

Toggle

Description​

<jp-toggle> is on/off switch component.


Attributes​

NameRequiredTypeDescription
valuebooleansetter and getter
name✓stringname of the form control
labelstringtext above the toggle
sizelarge | smallsize of the toggle button
disabledbooleandetermines if toggle is disabled
requiredbooleanif true toggle needs to be check to pass validity
requiredValidationMessagestringvalidation message for when component does not satisfy required


Slots​

This component does not have any slots.



Methods​

  • getValue
    • returns form field value
  • reportValidity
    • triggers reportValidity


Events​

  • value
    • triggers when toggle is switched


Demo​

Live Editor
// import '@jaspero/web-components/toggle.wc.js';
// import '@jaspero/web-components/toggle.css';

<jp-toggle></jp-toggle>
Result
Loading...