- Docs
- Get started
- Frameworks
- TanStack Start
TanStack Start
Qeetrix as the Qeet consoles set it up, with the console frame around every route.
- Time
- 5 minutesThree files
- Requires
- TanStack Start 1Vite 8, React 19.2
- Package manager
- Package manager
01 — Install
The packages.
bun add @qeetrix/react @qeetrix/tokens02 — Styles
Plain CSS, linked by the route.
No Vite plugin: Vite resolves the imports. The root route links the compiled file through ?url.
@import "@qeetrix/tokens/tokens.css";
@import "@qeetrix/react/styles.css" layer(components);03 — The root route
The scheme before the first paint.
ScriptOnce runs while the head parses, with the request's CSP nonce, and removes itself. QeetrixProvider then takes over; it's yours to keep the choice, here in local storage.
import { colorSchemeScript, QeetrixProvider, ToastProvider } from "@qeetrix/react";
import { createRootRoute, HeadContent, ScriptOnce, Scripts } from "@tanstack/react-router";
import type { ReactNode } from "react";
import appCss from "../styles.css?url";
export const Route = createRootRoute({
head: () => ({
meta: [{ charSet: "utf-8" }, { name: "viewport", content: "width=device-width, initial-scale=1" }],
links: [{ rel: "stylesheet", href: appCss }],
}),
shellComponent: RootDocument,
});
function RootDocument({ children }: { children: ReactNode }) {
return (
<html lang="en-IN" suppressHydrationWarning>
<head>
{/* The saved scheme, or the system's, on <html> before the first paint. */}
<ScriptOnce>{colorSchemeScript()}</ScriptOnce>
<HeadContent />
</head>
<body>
<QeetrixProvider locale="en-IN" defaultColorScheme="system" storageKey="qx-color-scheme">
<ToastProvider>{children}</ToastProvider>
</QeetrixProvider>
<Scripts />
</body>
</html>
);
}04 — The console frame
One AppShell, in a layout route.
The shell mounts once; each page brings its PageHeader and PageContent. See App shell for the top bar and the sidebar.
import { AppShell } from "@qeetrix/react/experimental";
import { createFileRoute, Outlet } from "@tanstack/react-router";
import { ConsoleSidebar } from "../shell/sidebar";
import { ConsoleTopBar } from "../shell/top-bar";
// The frame mounts once, around every page: routes change only what's inside it.
export const Route = createFileRoute("/_app")({
component: () => (
<AppShell topBar={<ConsoleTopBar />} sidebar={<ConsoleSidebar />}>
<Outlet />
</AppShell>
),
});import { PageContent, PageHeader } from "@qeetrix/react/experimental";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/_app/users")({
component: () => (
<>
<PageHeader title="Users" count={1284} />
<PageContent>…</PageContent>
</>
),
});