mount() renders your app component into the #app root element. It handles both fresh rendering and hydration of server-rendered HTML.
Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
app | () => Element | DocumentFragment | Component function that returns the app’s root element |
options | MountOptions | Optional configuration |
MountOptions
| Option | Type | Description |
|---|---|---|
theme | Theme | Design tokens from defineTheme() — compiled to CSS and injected |
styles | string[] | Global CSS strings to inject into <head> |
onMount | (root: HTMLElement) => void | Callback fired after mount completes |
Returns
MountHandle — an object with a dispose() method to unmount the app.
Usage
Basic
With theme and styles
Root element
mount() always targets #app — there is no selector parameter. The framework controls the HTML in every context (SSR, dev server, scaffolded templates), so the root element is always <div id="app">.
If #app is not found in the document, mount() throws an error.
Hydration
When server-rendered HTML exists inside#app, mount() performs tolerant hydration — it walks the existing DOM and adopts server-rendered nodes instead of replacing them. If hydration fails (mismatched structure), it falls back to full client-side rendering automatically.