[SalesForce] Is this possible to position label for inputCheckbox on the right hand side

When I try to use standard lightning tag ui:inputCheckbox it displays label on the left

<ui:inputCheckbox label="Checkbox label" labelClass="uiLabel-right" value="{!v.checkbox}"  change="{!c.onCheckboxValueChange}"/>

Label on the left

even though I am trying to set label Class as "uiLabel-right". I am not sure though if this is valid value for labelClass: I found this term in the comments for another question on SSE.

What am I trying to achieve is actually to get the result described in Lightning design system. However, I see that lightning tags library is contradicting Lightning design system, which seems to be quite strange.

I can't use pure html since I need to have onchange handler and easy boolean set for disabled attribute.

Is there any way to solve this contradiction between Lightning design system and Lightning framework?

Best Answer

There are actually two different possible ways.

  1. Looks like we could try to use tag lightning:input type="checkbox" at our own risk (the component declared as a "beta" state) as RedDevil suggested.

    <lightning:input type="checkbox" label="Checkbox label" onchange="{!c.onCheckboxValueChange}"/>

  2. Also it is possible to have a class .myCheckbox:

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

and to add this class to the inputCheckbox:

<ui:inputCheckbox label="Checkbox label" cClass="myCheckbox" value="{!v.checkbox}"  change="{!c.onCheckboxValueChange}"/>

as suggested D. Griff in his answer to his own question.