client:load

The client:load directive hydrates a UI framework component immediately on page load.

Since Astro 1.0 Spec ↗

Syntax

<Counter client:load />

Examples

---
import Counter from '../components/Counter.jsx';
---
<Counter client:load initial={0} />
Output
Ships and hydrates the Counter's JavaScript right away so it is interactive as soon as the page loads.

Notes

Use only for above-the-fold, immediately needed interactivity since it adds JS to the critical path. Prefer client:idle or client:visible for non-urgent islands to keep the page fast.

See also