Overview - client:load directive
What is it?
The client:load directive in Astro tells the browser to load and run a component's JavaScript only after the page has fully loaded. This means the component appears on the page immediately as static HTML, and its interactive behavior starts only when the browser finishes loading everything. It helps balance fast page display with interactive features.
Why it matters
Without client:load, interactive components might delay the page from showing or run JavaScript too early, causing slower load times or errors. Using client:load improves user experience by showing content quickly and adding interactivity only when ready. This is important for websites that want to be fast but still interactive.
Where it fits
Before learning client:load, you should understand basic Astro components and how Astro renders static HTML. After this, you can learn other client directives like client:idle and client:visible that control when components load JavaScript differently.