Book a call Free rebuild
Home/Glossary/Astro/Client Directives

Client Directives

By Seahawk November 16, 2026

Astro glossaryClient directives, such as client:load and client:visible, tell Astro to make a component interactive in the browser and when to load its JavaScript.

A client directive is an attribute on a UI component that turns it into an island and tells Astro when to load its JavaScript in the browser. Without one, the component is rendered to HTML only and ships no JavaScript.

The directives

  • client:load: load and hydrate as soon as the page loads, for things that must work at once.
  • client:idle: wait until the browser is idle.
  • client:visible: wait until the component scrolls into view.
  • client:media: load only when a CSS media query matches, such as a mobile menu.
  • client:only: skip server rendering and render only in the browser.

Choosing the latest sensible moment keeps the first load light: a comments widget at the bottom of a post rarely needs client:load.

Source: Astro docs: Template directives reference.

Em Workers

EmDash and Astro sites at revolutionary pricing.

Lightning-fast, secure websites delivered on EmDash and Astro. For the AI-curious bunch.