Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

__root.tsx

73 lines1.7 KB

1import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'
2import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'
3import { TanStackDevtools } from '@tanstack/react-devtools'
4import { aiDevtoolsPlugin } from '@tanstack/react-ai-devtools'
5import Header from '../components/Header'
6import appCss from '../styles.css?url'
7​
8export const Route = createRootRoute({
9 head: () => ({
10 meta: [
11 {
12 charSet: 'utf-8',
13 },
14 {
15 name: 'viewport',
16 content: 'width=device-width, initial-scale=1',
17 },
18 {
19 title: 'TanStack Start Starter',
20 },
21 ],
22 links: [
23 {
24 rel: 'stylesheet',
25 href: appCss,
26 },
27 {
28 rel: 'icon',
29 type: 'image/svg+xml',
30 href: 'https://tanstack.com/favicon-light.svg',
31 media: '(prefers-color-scheme: light)',
32 },
33 {
34 rel: 'icon',
35 type: 'image/svg+xml',
36 href: 'https://tanstack.com/favicon-dark.svg',
37 media: '(prefers-color-scheme: dark)',
38 },
39 ],
40 }),
41​
42 shellComponent: RootDocument,
43})
44​
45function RootDocument({ children }: { children: React.ReactNode }) {
46 return (
47 <html lang="en">
48 <head>
49 <HeadContent />
50 </head>
51 <body>
52 <Header />
53 {children}
54 <TanStackDevtools
55 config={{
56 position: 'bottom-right',
57 }}
58 plugins={[
59 {
60 name: 'Tanstack Router',
61 render: <TanStackRouterDevtoolsPanel />,
62 },
63 aiDevtoolsPlugin(),
64 ]}
65 eventBusConfig={{
66 connectToServerBus: true,
67 }}
68 />
69 <Scripts />
70 </body>
71 </html>
72 )