Skip to main content

Client hydration

Silva UI renders on the server by default. Hydrate only the part of a page that needs browser state, handlers, or browser APIs.

Option 1: Hydrate a Hono JSX root

Render the same component on the server and mount it in the browser with hono/jsx/dom.
Render <div id="counter"> around the server output and load the bundled client.tsx script after it. The server markup and first client render must match.

Option 2: Render only in the browser

Use render instead of hydrate when there is no matching server markup.
This is suitable for an optional widget, not the primary page UI.

Option 3: Use HonoX islands

For HonoX applications, put an interactive component in app/islands. HonoX handles its client entry and hydration automatically.
See the full HonoX setup.

Practical choice

  • Server only: static pages, navigation, and form markup.
  • hydrate: an interactive server-rendered area.
  • render: a client-only widget.
  • HonoX island: isolated interaction in a HonoX app.
Always import silva-ui/style.css into the browser bundle that mounts the component.