function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael J. LupinoMichael J. Lupino 

ui: inputcheckbox SLDS styling

I have a hopefully simple request but I feel like I'm missing something (could be that I'm missing something because I'm doing it at 2AM). I have a UI:inputcheckbox that I would like to wrap with some slds styling. I can't seam to modify the styling for that element. Ideally I'm looking for styling similar to the following page: https://www.lightningdesignsystem.com/components/forms/#flavor-checkbox-add-button (span class="slds-checkbox">)


Lightning Component:

<aura:component controller="TSTWRP_DisplayPosition" implements="force:appHostable,
                                                                flexipage:availableForAllPageTypes,
                                                                flexipage:availableForRecordHome,
                                                                force:hasRecordId,forceCommunity:availableForAllPageTypes" 
                access="global" >
    <!--  <ltng:require styles="/resource/bootstrap/css/bootstrap.min.css" 
      scripts="/resource/bootstrap/js/jquery-2.js,/resource/bootstrap/js/bootstrap.min.js" /> -->
    <aura:attribute name="lstAccounts" 
                    type="TSTWRP_CommonWrapperClass.DisplayAccountRecords[]" />    
    
    
    <!--- on initialization of component init event will fire and doInit action will execute-->
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    
    
    <div class="container">
        <h2>Account List</h2>
        <br></br>
        <table class="table table-striped">
            <thead>
                <tr>
                    <th></th>
                    <th>Account</th>
                </tr>
            </thead>
            <tbody>
                
                <aura:iteration var="Account" items="{!v.lstAccounts}" >
                    <tr>
                        <td><ui:inputCheckbox value="{!Account.isSelected}"/></td>
                        <td><ui:outputText value="{!Account.AccountName}"/></td>
                    </tr>
                </aura:iteration>
            </tbody>
        </table>
        <br></br>

        <!-- Test Bed -->
        
        
        <ui:button class="btn btn-default" press="{!c.doSomething}">Perform Action</ui:button>
        
    </div>
 </aura:component>
Best Answer chosen by Michael J. Lupino
NagendraNagendra (Salesforce Developers) 
Hi Michael,

Please try this sample code and modify it as per the requirement.
<div class="slds-media__body">
    <div class="slds-media">
        <div class="slds-media__figure">
            <label class="slds-checkbox" for="mark-complete">
                <input name="checkbox" type="checkbox" checked="true" id="mark-complete" />
                <span class="slds-checkbox--faux"></span>
                <span class="slds-form-element__label slds-assistive-text">mark-complete</span>
            </label>
        </div>
        <div class="slds-media__body">
            <p class="slds-section-title slds-truncate"><a href="#">This is a checked checkbox</a></p>
        </div>
    </div>
</div>
Best Regards,
Nagendra.
 

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Michael,

Please try this sample code and modify it as per the requirement.
<div class="slds-media__body">
    <div class="slds-media">
        <div class="slds-media__figure">
            <label class="slds-checkbox" for="mark-complete">
                <input name="checkbox" type="checkbox" checked="true" id="mark-complete" />
                <span class="slds-checkbox--faux"></span>
                <span class="slds-form-element__label slds-assistive-text">mark-complete</span>
            </label>
        </div>
        <div class="slds-media__body">
            <p class="slds-section-title slds-truncate"><a href="#">This is a checked checkbox</a></p>
        </div>
    </div>
</div>
Best Regards,
Nagendra.
 
This was selected as the best answer
Michael J. LupinoMichael J. Lupino
Thanks for your assistance. For some reason one of my DIVs was not closing correctly so the styling was not being applied. Thats what it ended up being BUT the sample was helpful to resolve.