Hanzo
Quick StartManual installation

Tanstack Start

Setup Hanzo Docs on Tanstack Start.

Getting Started

Before continuing, make sure to configure:

  • Tailwind CSS 4.
  • Hanzo Docs MDX: follow the Vite setup guide and create essential files like lib/source.ts.

Installation

npm i @hanzo/docs-core @hanzo/docs-ui

Styles

Add the following to your Tailwind CSS file:

@import 'tailwindcss';
@import '@hanzo/docs-ui/css/neutral.css';
@import '@hanzo/docs-ui/css/preset.css';

Create Pages

Create the following files:

import defaultMdxComponents from '@hanzo/docs-ui/mdx';
import type { MDXComponents } from 'mdx/types';

export function getMDXComponents(components?: MDXComponents) {
  return {
    ...defaultMdxComponents,
    ...components,
  } satisfies MDXComponents;
}

export const useMDXComponents = getMDXComponents;

declare global {
  type MDXProvidedComponents = ReturnType<typeof getMDXComponents>;
}

Wrap your entire app under Hanzo Docs providers:

import { createRootRoute, HeadContent, Outlet, Scripts } from '@tanstack/react-router';
import * as React from 'react';
import { RootProvider } from '@hanzo/docs-ui/provider/tanstack';

export const Route = createRootRoute({
  component: RootComponent,
});

function RootComponent() {
  return (
    <RootDocument>
      <Outlet />
    </RootDocument>
  );
}

function RootDocument({ children }: { children: React.ReactNode }) {
  return (
    <html suppressHydrationWarning>
      <head>
        <HeadContent />
      </head>
      <body className="flex flex-col min-h-screen">
        <RootProvider>{children}</RootProvider>
        <Scripts />
      </body>
    </html>
  );
}

Done

You can start writing documents at content/docs:

---
title: Hello World
---

I love Hanzo Docs

How is this guide?

Last updated on

On this page