# SSGOI with Qwik City
Experimental API: the router integration may change.
Qwik serializes component state, while transition configs contain functions.
Expose the config through a QRL factory.
```bash
npm install @ssgoi/qwik
```
Shell class strings below are Tailwind shorthand. Without Tailwind, apply
`position: relative; z-index: 0; min-height: 100dvh; overflow-x: clip`. Use
`clip`, not `hidden`: `overflow-x: hidden` makes the wrapper the scroll
container, and scroll restore then targets the wrong element. Fall back to
`100vh` only where `dvh` is unsupported.
```tsx
// src/lib/ssgoi-config.ts
import { $ } from "@builder.io/qwik";
import { drill } from "@ssgoi/qwik/view-transitions";
export const config$ = $(() => ({
transitions: [
{ on: "/posts/**", except: "/posts", transition: drill() },
],
}));
```
Attach SSGOI to the element that directly owns ``.
```tsx
// src/routes/layout.tsx
import { Slot, component$, useSignal } from "@builder.io/qwik";
import { useSsgoi } from "@ssgoi/qwik";
import { config$ } from "../lib/ssgoi-config";
export default component$(() => {
const root = useSignal();
useSsgoi(root, { config$ });
return (
);
});
```
## Router boundary helper
The computed boundary helper reads Qwik City’s location. The page keeps ownership of its DOM and slots; apply the returned id and key to its own root.
### Mark the page root
Call the hook in a Qwik City page or layout, not root.tsx. An explicit key replaces the page root when a parameterized route is reused. Query and hash changes keep the same key.
```tsx
import { component$ } from "@builder.io/qwik";
import { useSsgoiRouteBoundary } from "@ssgoi/qwik/qwik-city";
export default component$(() => {
const boundary = useSsgoiRouteBoundary();
return (
{/* Page content */}
);
});
```
### Persistent layouts
Pass a stable route key to useSsgoiRouteBoundary("shell") for an outer shell, and retain separately keyed page roots below it. The helper does not wrap or move Slot content.
## Persistent layout
A Qwik City route layout may own an outer boundary:
```tsx
import { Slot, component$ } from "@builder.io/qwik";
import { useLocation } from "@builder.io/qwik-city";
export default component$(() => {
const location = useLocation();
return (
);
});
```
Keep child page boundaries for tab changes. Do not add another SSGOI root.
## Reference
- Shared config and route patterns: https://ssgoi.dev/llms/route-rules.txt
- Qwik template: https://github.com/meursyphus/ssgoi/tree/HEAD/templates/qwik
- Transition catalog: https://ssgoi.dev/llms/transitions.txt
- Framework index: https://ssgoi.dev/llms/frameworks.txt