0

I am new to LDS and trying to develop a component with Lightning design systems toggle checkbox and my goal is to hide and show certain input label when toggle is enabled and disabled , my questions

1)how would i know the events and attributes of LDS toggle checkbox? 2)onclick,tried onchange isnt working so i think this is not the right event. 3)while the same event works fine with inputcheckbox and am able to achieve whatever functionality i need

<aura:component>
<div class="slds-form-element">
<label class="slds-checkbox--toggle slds-grid">
<span class="slds-form-element__label slds-m-bottom--none">Do You Have More 
Information</span>
<input type="checkbox" name="checkbox" aria-describedby="toggle-desc" />
<span id="toggle-desc" class="slds-checkbox--faux_container" aria-
live="assertive">
 <span class="slds-checkbox--faux"></span>
 <span class="slds-checkbox--on" onclick="{!c.run}">Yes</span>
 <span class="slds-checkbox--off" >No</span>
</span>
</label>
</div>
<aura:component>

below works fine and is able to fire run event

<ui:inputcheckbox value="{!v.check}" click="{!c.run}" />
0

I suggest you use the lightning:input (Beta) component with type="toggle". This keeps you in the world of Lightning Components rather than having to integrate raw HTML elements with Lightning Components.

The output is illustrated in Mohith Shrivastava's Wiki page Lightning Base Components Designer Guide.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.