ui:inputCheckbox how to allign with the checkbox itself

i tried to add a checkbox using ui:inputCheckbox and i wasn’t able to align the checkbox with the label

this is the code:

<ui:inputCheckbox aura:id="leadsCheckBox" label="leads" click="{!c.handleFilters}" value="true"/>

and in the web app i see

enter image description here

please assist,
thanks

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I found the answer!
I wrote a class in css called .myCheckbox:

.THIS .myCheckbox{
  display: inline-block;
  float: left;
}

and added the class to the inputCheckbox:

<ui:inputCheckbox class="myCheckbox" aura:id="checkboxLeads" label="Leads" change="{!c.doInit}" value="True"/>

Method 2

You can use <p> tag or even a <div> to display the label separately.

<div>leads</div>
<ui:inputCheckbox aura:id="leadsCheckBox"  click="{!c.handleFilters}" value="true"/>

Method 3

I used standard SLDS classes to achieve it :

  <ui:inputCheckbox aura:id="checkbox" labelClass="slds-p-horizontal--small slds-float--left" label="My Check" change="{!c.onCheck}"/>


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x