You need to sign in to do that
Don't have an account?

align radiobutton horizontally in lightning
I have piece of code inside my lightning component.
<lightning:card title="Advanced Provider">
<lightning:layout multipleRows="true">
<lightning:layoutItem size="4" padding="around-small">
<dl class="slds-form_horizontal">
<dt title="Network ID">
<lightning:select name="select1" label="Network ID">
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</lightning:select></dt></dl>
<dl class="slds-form_horizontal"><dt title="EPDB Flag">
<lightning:select name="select2" label="EPDB Flag">
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</lightning:select></dt></dl>
<dl class="slds-form_horizontal"><dt title="Language">
<lightning:select name="select3" label="Language">
<option value="1">French</option>
<option value="2">English</option>
<option value="3">German</option>
</lightning:select></dt></dl>
<dl class="slds-form_horizontal slds-wrap"><dt title="Gender">
<lightning:radioGroup name="radioGroup"
label="Gender"
options="{!v.optRadio}"
value="{!v.optRadioValue}"
type="radio"/></dt></dl>
</lightning:layoutItem>
</lightning:layout>
</lightning:card>
when I preview the page the radiobuttons appear as follows

But I want the radiobutton to be placed horizontally not vertically
It should be like this
Gender : <radioButton>Male <radiobutton>Female
I tried to use as <dl class="slds-list_inline"> but I am not getting radiobuttons horizontally aligned.
Please show me piece of working code.
thanks
meghna
<lightning:card title="Advanced Provider">
<lightning:layout multipleRows="true">
<lightning:layoutItem size="4" padding="around-small">
<dl class="slds-form_horizontal">
<dt title="Network ID">
<lightning:select name="select1" label="Network ID">
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</lightning:select></dt></dl>
<dl class="slds-form_horizontal"><dt title="EPDB Flag">
<lightning:select name="select2" label="EPDB Flag">
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</lightning:select></dt></dl>
<dl class="slds-form_horizontal"><dt title="Language">
<lightning:select name="select3" label="Language">
<option value="1">French</option>
<option value="2">English</option>
<option value="3">German</option>
</lightning:select></dt></dl>
<dl class="slds-form_horizontal slds-wrap"><dt title="Gender">
<lightning:radioGroup name="radioGroup"
label="Gender"
options="{!v.optRadio}"
value="{!v.optRadioValue}"
type="radio"/></dt></dl>
</lightning:layoutItem>
</lightning:layout>
</lightning:card>
when I preview the page the radiobuttons appear as follows
But I want the radiobutton to be placed horizontally not vertically
It should be like this
Gender : <radioButton>Male <radiobutton>Female
I tried to use as <dl class="slds-list_inline"> but I am not getting radiobuttons horizontally aligned.
Please show me piece of working code.
thanks
meghna
Try this code:
Component: Custome CSS:
Follow this link for more information:
http://sfdcmonkey.com/2018/08/03/radio-button-group-horizontal-view/
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
I have seen this piece of code from sfdcmonkey website.
But my question using slds classes only can we implement the same or not?
thanks
meghna
You can also you slds-grid as follows for your requirement: Thanks,
Ajay Dubedi
Greetings to you!
- I read your problem 'align radiobutton horizontally in lightning'.
- I implemented in my Org and the solution is you have to change 'display: block' to 'display: inline' so please use Below CSS [Solved] : -
CSS : -
.THIS .slds-form-element__control .slds-radio{
display: inline !important;
}
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha.