Skip to content

Instantly share code, notes, and snippets.

@saicharanreddyk
Last active February 6, 2020 05:25
Show Gist options
  • Save saicharanreddyk/84ac59ed2bff940bdff6d51429737263 to your computer and use it in GitHub Desktop.
Save saicharanreddyk/84ac59ed2bff940bdff6d51429737263 to your computer and use it in GitHub Desktop.
Lightning - Layout and LayoutItem
A lightning:layout is a flexible grid system for arranging containers within a page or inside another container.
The default layout is mobile-first and can be easily configured to work on different devices.
A lightning:layoutItem is the basic element within lightning:layout.
You can arrange one or more layout items inside lightning:layout.
The attributes of lightning:layoutItem enable you to configure the size of the layout item,
and change how the layout is configured on different device sizes.
>> we need to use multipleRows="true" in order to get the benifit of lightning:layoutItem
>> default size is 12
Component
**********************************************************************************************
<aura:component >
<lightning:layout multipleRows="true">
<lightning:layoutItem size="4" padding="around-medium">
<div class="box">Layout Item 1</div>
</lightning:layoutItem>
<lightning:layoutItem size="4" padding="around-medium">
<div class="box">Layout Item 1</div>
</lightning:layoutItem>
<lightning:layoutItem size="4" padding="around-medium">
<div class="box">Layout Item 1</div>
</lightning:layoutItem>
</lightning:layout>
</aura:component>
**********************************************************************************************
Style
**********************************************************************************************
.THIS .box {
border: 1px solid grey;
background-color: yellow;
text-align: center;
}
**********************************************************************************************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment