Salesforce CRM

How to use lightning:layout and lightning:layoutItem

Build a responsive Aura layout with predictable column sizes, spacing and wrapping. This guide keeps the Aura syntax separate from Lightning Web Components.

Start with the right component syntax

lightning:layout and lightning:layoutItem belong to Aura. In Lightning Web Components, their equivalents are lightning-layout and lightning-layout-item. Keep examples from the two frameworks separate: an Aura attribute such as smallDeviceSize uses a different spelling from the LWC small-device-size attribute.

Salesforce: Aura layout component reference

Choose layout alignment and wrapping

AttributePurpose
horizontalAligncenter, space, spread or end control horizontal placement.
verticalAlignstart, center, end or stretch control vertical alignment.
multipleRowsSet true when items should wrap to another row.
pullToBoundarysmall, medium or large counter matching item padding at the edges.
Common lightning:layout attributes

Use spacing deliberately. Padding adds room inside each item; alignment distributes items within the layout. If the labels seem far apart, check both settings before adding more CSS.

Set the base size before device overrides

The layout divides available width into 12 columns. A size of 12 takes a full row; 6 uses half; 4 uses one third. Include size whenever you specify a device size. Larger breakpoints inherit the last applicable setting unless you override it.

AttributeApplies from
sizeThe base size, including screens narrower than 480px.
smallDeviceSize480px and wider.
mediumDeviceSize768px and wider.
largeDeviceSize1024px and wider.
Responsive sizes for Aura layout items

Salesforce: layout item sizing

Salesforce: grids and responsive layout breakpoints

A responsive three-card example

This Aura component stacks the cards on narrow screens, uses two columns from the small breakpoint and three from the large breakpoint. At two columns, the third card wraps. Replace the sample content with your own UI.

Aura component markup

<aura:component>
  <lightning:layout multipleRows="true">
    <lightning:layoutItem size="12" smallDeviceSize="6"
        largeDeviceSize="4" padding="aroundSmall">
      <div class="slds-box">Applications</div>
    </lightning:layoutItem>
    <lightning:layoutItem size="12" smallDeviceSize="6"
        largeDeviceSize="4" padding="aroundSmall">
      <div class="slds-box">Documents</div>
    </lightning:layoutItem>
    <lightning:layoutItem size="12" smallDeviceSize="6"
        largeDeviceSize="4" padding="aroundSmall">
      <div class="slds-box">Follow-up</div>
    </lightning:layoutItem>
  </lightning:layout>
</aura:component>

Notice padding="aroundSmall" in the Aura example. Do not substitute an LWC-style hyphenated value into this markup. For a different layout, change the column sizes before reaching for fixed pixel widths.

Test the content, not just empty boxes

Responsive sizing controls the grid. It does not automatically make a wide table or a fixed-width child element fit. Inspect the content inside an overflowing item as well as the layout attributes.

Need help applying this to your Salesforce org?

Bring one example of the process or component you want to improve. We can discuss the requirement, the systems involved and the next step toward a scoped approach and estimate.

Discuss your Salesforce requirements

Explore the related service ↗

LET’S TALK ABOUT YOUR CRM

Start with a free CRM & AI Health Check.

A 30-minute review of your CRM with Nigam Goyal, then a written 30-day plan within 48 hours. Free, and yours to keep.

Book your free Health Check

Prefer to write? Send a project enquiry →