Play Games

Search This Blog

Showing posts with label how to display toggle icon or toggle button in aura component.. Show all posts
Showing posts with label how to display toggle icon or toggle button in aura component.. Show all posts

Tuesday, October 6, 2020

how to display toggle icon or toggle button in aura component - Salesforce Globe For You

 how to display toggle icon or toggle button in aura component  - Salesforce Globe For You 

Example:ToggleIcon.cmp

<aura:component >

    <aura:attribute name="checkboxValue" type="boolean" default="false"/> 

<lightning:input type="toggle" label="Toggle Button:" aura:id="toggleButton" checked="false" name="toggleButton"  onchange="{!c.changeCheckboxValue}"/><br/>

The toggle value is:<b>{!v.checkboxValue}</b>

</aura:component>

ToggleIconController.js

({

changeCheckboxValue : function(component, event, helper) {

        // get the toggleButton element and check its value

var togglebuttonValue = component.find("toggleButton").get("v.checked");

        component.set("v.checkboxValue",togglebuttonValue);

}

})

TestApp.app

<aura:application extends="force:slds">

<c:ToggleIcon/>

</aura:application>

Output: