qwik-docs ships a default UI built from a set of named components — the header, the sidebar, pagination, search, the footer, and more.
To replace any one of them, map its name to your own Qwik component through the components option in qwik-docs.config.ts.
The framework swaps your component in wherever the built-in would render, on every page.
The components config map
The components option maps a built-in component name to a project-relative path to a replacement Qwik .tsx file.
This mirrors Astro Starlight's components option, adapted to qwik-docs.config.ts and Qwik components.
// qwik-docs.config.ts
import { defineConfig } from '@qwik-docs/framework';
export default defineConfig({
components: {
Header: './src/overrides/MyHeader.tsx',
},
});
With this in place, the framework renders MyHeader in place of the built-in Header on every page.
Everything else keeps the default UI.
Overridable component names
Each key of components is one of the built-in UI components.
The names match the exports from @qwik-docs/framework/components.
| Name | Role |
|---|---|
Header | Top bar: site title, search, social icons, theme select |
Sidebar | Left navigation |
SidebarSublist | Nested list rendered inside the sidebar |
Pagination | Prev/next links |
TableOfContents | On-page heading list |
MobileTableOfContents | Table of contents shown on narrow viewports |
Search | Search widget |
EditLink | "Edit this page" link |
Footer | Footer with pagination, edit link, last-updated |
MobileMenuFooter | Footer inside the mobile navigation menu |
Page | Full page layout that composes everything above |
PageFrame | Header + sidebar + content shell with named slots |
Reusing the built-in with Default
A partial override composes on top of the framework UI: import the built-in you are replacing, alias it to Default, and render it inside your override.
The components barrel @qwik-docs/framework/components exports every name in the table above, so import { Header as Default } from '@qwik-docs/framework/components' gives you the stock header to wrap.
A replacement reads the current page from useRouteData(), so it can render the built-in on some pages and custom UI on others.
Override the Header
Create the replacement, then point components.Header at it.
// src/overrides/MyHeader.tsx
import { component$ } from '@builder.io/qwik';
import { Header as Default, Search } from '@qwik-docs/framework/components';
export default component$(() => (
<div class="my-header">
<a href="/" class="my-brand">My Docs</a>
<Search />
<Default />
<a href="mailto:houston@example.com">E-mail Me</a>
</div>
));
// qwik-docs.config.ts
import { defineConfig } from '@qwik-docs/framework';
export default defineConfig({
components: {
Header: './src/overrides/MyHeader.tsx',
},
});
<Default /> renders the built-in Header — the same site title, search, social icons, and theme select the framework ships.
Wrapping it lets you add a brand link and a contact link without rebuilding the header from scratch.
Override on specific pages only
An override renders on every page, so branch inside it on the current page's data.
useRouteData() returns the same RouteData object every framework component reads, including slug and title.
Render your custom UI when the data matches, and fall back to <Default /> everywhere else.
// src/overrides/MyFooter.tsx
import { component$ } from '@builder.io/qwik';
import { Footer as Default, useRouteData } from '@qwik-docs/framework/components';
export default component$(() => {
const data = useRouteData();
if (data.slug === 'docs') {
return <footer class="landing-footer">Built with qwik-docs</footer>;
}
return <Default />;
});
// qwik-docs.config.ts
components: {
Footer: './src/overrides/MyFooter.tsx',
},
The landing page (slug docs) gets a bespoke footer; every other page keeps the default footer with its pagination, edit link, and last-updated line.
Customize by owning the route
The components map replaces named pieces in place.
When you need to change how the pieces fit together — reorder the layout, drop a region, or wrap the whole shell — own the Qwik City route and compose the framework components yourself.
This approach complements the override map: reach for it when a single-component swap is not enough.
Documentation content renders through one catch-all route at src/routes/docs/[...slug]/index.tsx.
That route composes <DocsProvider> and <Page>, and passes the page content as children.
You own this route. Change how it composes the framework components to change the UI.
The default route looks like this:
// src/routes/docs/[...slug]/index.tsx
import { DocsProvider, Page } from '@qwik-docs/framework/components';
export default component$(() => {
const data = useDocsData();
// …load MDX content…
return (
<DocsProvider data={data.value}>
<Page>
<div class="sl-markdown-content">{/* content */}</div>
</Page>
</DocsProvider>
);
});
<Page> orchestrates the full layout: skip link, PageFrame, Header, Sidebar, table of contents, page title, content, and Footer.
<DocsProvider> supplies the route data that every framework component reads.
To customize deeper, drop <Page> and assemble the layout components yourself.
Each of these is exported from @qwik-docs/framework/components:
| Component | Role |
|---|---|
Page | Full page layout that composes everything below |
PageFrame | Header + sidebar + content shell with named slots |
Header | Top bar: site title, search, social icons, theme select |
CustomHeader | Header with named slots for custom sections |
Sidebar | Left navigation |
Pagination | Prev/next links |
TableOfContents | On-page heading list |
Search | Search widget |
EditLink | "Edit this page" link |
Footer | Footer with pagination, edit link, last-updated |
Reuse a built-in component
The framework components are plain Qwik components. Import and render them inside your own component to keep the default UI while adding your own alongside it.
CustomHeader is built for this case.
It exposes three named slots — site-title, search, and right-group — so you can inject your own content into each section of the header:
// src/components/MyHeader.tsx
import { component$ } from '@builder.io/qwik';
import { CustomHeader, Search } from '@qwik-docs/framework/components';
export const MyHeader = component$(() => (
<CustomHeader>
<a q:slot="site-title" href="/">My Docs</a>
<Search q:slot="search" />
<a q:slot="right-group" href="mailto:houston@example.com">E-mail Me</a>
</CustomHeader>
));
Because Qwik slots render nothing when unfilled, fill every slot whose content you want to keep.
Use page data
Every framework component reads the current page's data from context.
Your own components read the same data through useRouteData from @qwik-docs/framework/components, inside a <DocsProvider>:
// src/components/PageTitle.tsx
import { component$ } from '@builder.io/qwik';
import { useRouteData } from '@qwik-docs/framework/components';
export const PageTitle = component$(() => {
const data = useRouteData();
return <h1 id="_top">{data.title}</h1>;
});
useRouteData returns the same RouteData object described in the Route Data Reference.
It carries the title, sidebar, table of contents, pagination, edit URL, and head tags for the current page.
Overrides and route-composed components read from the same object, so they branch on the same fields — slug, title, and the rest of the current page.
Related
- Pages — build a custom route with the docs design using
generateRouteData,DocsProvider, andPage. - Route Data Reference — every field on the object
useRouteDatareturns.