← Public packages
@kody/app-starter
A basic TanStack app with a design system, light and dark, sign-in, and storage already wired up.
Files
import type { ReactNode } from 'react'
import type { RouterContext } from './router-context.ts'
/** The HTML shell. Boot data for the browser rides on `data-*` attributes. */
export function Document(props: {
context: RouterContext
title: string
children: ReactNode
}) {
const { context } = props
const assetBase = context.assetBasePath.replace(/\/$/, '')
return (
<html
lang="en"
data-app-base={context.appBasePath}
data-asset-base={assetBase}
data-hosted-url={context.hostedUrl ?? ''}
data-visitor={context.visitor ? JSON.stringify(context.visitor) : ''}
>
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="color-scheme" content="light dark" />
<title>{props.title}</title>
<link rel="stylesheet" href={`${assetBase}/tokens.css`} />
<link rel="stylesheet" href={`${assetBase}/styles.css`} />
</head>
<body>
{props.children}
{context.dehydratedState ? (
<script
id="query-state"
type="application/json"
dangerouslySetInnerHTML={{
__html: JSON.stringify(context.dehydratedState).replace(/</g, '\\u003c'),
}}
/>
) : null}
{context.clientModuleUrl ? (
<script type="module" src={context.clientModuleUrl} />
) : null}
</body>
</html>
)
}