Check out example codes for "salesforce aura toggle input". It will help you in understanding the concepts better.

Code Example 1

<aura:component>
    <lightning:input type="toggle" label="Basic option" name="input1"/>
    <lightning:input type="toggle" label="Required option" name="input2" checked="true" required="true"/>
    <lightning:input type="toggle" label="Disabled option" name="input3" checked="true" disabled="true"/>
</aura:component>

Code Example 2

<template>
    <lightning-input type="toggle"
                     label="Toggle value"
                     checked>
    </lightning-input>
</template>

Learn ReactJs, React Native from akashmittal.com