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

align lightning:select with text
I have a piece of code inside by lightning component as follows:
<lightning:card title="Advanced Provider Search">
<lightning:layout multipleRows="true">
<lightning:layoutItem size="3" padding="around-small">
<span>Network ID</span><lightning:select name="select1" label="">
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</lightning:select>
</lightning:layoutItem>
</lightning:layout>
</lightning:card>
I want to the output as follows
At present when I preview the page the output is as follows
Network ID
<dropdnown List>
But I need the text and the dropdownlist to be aligned in the same line as follows.
Network ID : < dropdownList>
Please tell me how I can achieve this.
thanks
meghna
<lightning:card title="Advanced Provider Search">
<lightning:layout multipleRows="true">
<lightning:layoutItem size="3" padding="around-small">
<span>Network ID</span><lightning:select name="select1" label="">
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</lightning:select>
</lightning:layoutItem>
</lightning:layout>
</lightning:card>
I want to the output as follows
At present when I preview the page the output is as follows
Network ID
<dropdnown List>
But I need the text and the dropdownlist to be aligned in the same line as follows.
Network ID : < dropdownList>
Please tell me how I can achieve this.
thanks
meghna
Greetings to you!
You can use label attribute of lightning:select component. By placing the <lightning:select> in a horizontal form, it will transform the labels to the left.
Please refer to the below links which might help you further with the above requirement.
http://www.lightningdesignsystem.com/components/form-element/#Horizontal
https://www.lightningdesignsystem.com/utilities/name-value-list/#content
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
Greetings to you!
You can use label attribute of lightning:select component. By placing the <lightning:select> in a horizontal form, it will transform the labels to the left.
Please refer to the below links which might help you further with the above requirement.
http://www.lightningdesignsystem.com/components/form-element/#Horizontal
https://www.lightningdesignsystem.com/utilities/name-value-list/#content
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
This worked. Thanks for your post.
meghna