This package has been deprecated

Author message:

Please use the new scope @axa-ch-webhub-cloud

@axa-ch/toggle-switch

5.0.4 • Public • Published

AXA Toggle Switch

<axa-toggle-switch> provides a UI element for toggling between two states, active and inactive. You can use it in React controlled components.

Properties

checked

The Boolean attribute checked sets the visual state of the toggle switch to active, if true, and inactive otherwise. If checked is defined when first set under React, controlled-component mode is activated.

disabled

The Boolean attribute disabled, when true, disables the toggle switch natively.

error

The string attribute error sets an error text. Leave error empty, if you do not want an error text.

onToggle

The function-valued attribute onToggle can be used as a callback prop for React and other frameworks.

The callback prop value has the following Typescript signature:

    onToggle?: (checked: boolean) => void;

Events

Both a change event and a Custom Event are fired on the component itself. The events bubble and are cancellable. The Custom Event axa-toggle-switch-toggle's detail property contains {checked: boolean}, where the meaning of checked is as defined above for the same-named property.

Readme

Keywords

none

Package Sidebar

Install

npm i @axa-ch/toggle-switch

Weekly Downloads

4

Version

5.0.4

License

Copyright 2021 AXA Versicherungen AG

Unpacked Size

34.9 kB

Total Files

7

Last publish

Collaborators

  • gianlucaguarini
  • valentin-hasler
  • marek.laco
  • domirs
  • axa-ch-user
  • matthias.zuercher