---
includeMockServer: true
title: "Lazy Load"
description: Load content after the page renders
icon: "icon-[bitcoin-icons--visible-filled]"
---
## Basic usage
On the client, put a placeholder where the content will go.
```html
Loading...
```
- [`hx-get`](/reference/attributes/hx-get)=`/weather` might query a database or call an external API.
- [`hx-trigger`](/reference/attributes/hx-trigger)=[`"load"`](/reference/attributes/hx-trigger#load) fires the request as soon as the element enters the DOM.
On the server, respond with the HTML content. htmx swaps it into the placeholder when it arrives.
```html
5-Day Forecast
Monday: 72° Sunny
Tuesday: 68° Cloudy
```
## Multiple sections
Each placeholder loads independently. Your page renders fast even if several sections are slow:
```html
Loading sales...
Loading analytics...
Loading notifications...
```
All three requests fire in parallel when the page loads.
## Notes
### Layout shift
When the response swaps in, it can push content below it down. This is known as [Cumulative Layout Shift (CLS)](https://web.dev/articles/cls) and affects your [Lighthouse](https://developer.chrome.com/docs/lighthouse) score.
Reserve space with `min-height`:
```html
Loading...
```
The demo above does exactly this.
### Infinite loops
Be careful when including `hx-trigger="load"` in the server response.
```
load → GET /weather → response has hx-trigger="load" → load → GET /weather → …
```
If the response requests the same endpoint, it can create an infinite loop.