Configuration

Configure your Petit documentation site

Last updated March 19, 2026

The petit.config.json file controls your site's appearance, navigation, and features. It lives at your project root.

Full example

Here is a config file using every available option:

{
  "title": "My Project",
  "logo": "logo.png",
  "repository": "https://github.com/user/repo",
  "branch": "main",
  "siteUrl": "https://docs.example.com",
  "deploy": "node",
  "defaultScheme": "dark",
  "schemeSwitcher": true,
  "theme": "default",
  "fonts": {
    "sans": "Inter",
    "mono": "JetBrains Mono"
  },
  "maxWidth": "lg",
  "sidebarPosition": "left",
  "toc": true,
  "credits": true,
  "sidebar": [
    { "label": "Getting Started", "path": "./docs/getting-started" },
    { "label": "API Reference", "path": "./docs/api" },
    { "label": "Examples", "path": "./docs/examples" }
  ]
}

Only title is required. Everything else has sensible defaults.

Options

PetitConfig
PropertyTypeDefaultDescription
titlestringrequiredSite title in the sidebar header
logostring-Logo filename, resolved from media directory
mediaDirstringautoPath to media/images directory, relative to config
repositorystring-GitHub URL, adds "Edit on GitHub" links
branchstring"main"Git branch for "Edit on GitHub" links
siteUrlstring-Production URL, enables SEO (sitemap, OG images, llms.txt)
deploy"node" \| "cloudflare" \| "netlify" \| "vercel" \| "bun""node"Deploy target platform (see deployment guide)
defaultScheme"dark" \| "light" \| "system""system"Color scheme on first visit
schemeSwitcherbooleantrueShow the light/dark toggle
themestring"default"Theme preset for colors and fonts
themeOverridesThemeConfig-Override CSS variables per color scheme
fonts{ sans?: string, mono?: string }-Custom Google Fonts for body and code text
maxWidth"sm" \| "md" \| "lg" \| "xl""lg"Content area max width
sidebarPosition"left" \| "right" \| "center""left"Sidebar placement
tocbooleantrueShow "On this page" table of contents
creditsbooleanfalseShow "Created with petit" link at the bottom of the sidebar
sidebarSidebarItem[][]Navigation structure (see below)

Each sidebar entry has a label and an optional path. Paths point directly to folders containing .md files, relative to the config file:

{
  "sidebar": [
    { "label": "Getting Started", "path": "./docs/getting-started" },
    { "label": "Reference" },
    { "label": "Core", "path": "./docs/reference/core" },
    { "label": "Plugins", "path": "./docs/reference/plugins" }
  ]
}

"Reference" here is a visual divider. "Core" and "Plugins" each list the pages found in their directories.

In a monorepo you can pull docs from multiple locations:

{
  "sidebar": [
    { "label": "Getting Started", "path": "./docs/getting-started" },
    { "label": "Core API", "path": "./packages/core/docs" },
    { "label": "CLI", "path": "./packages/cli/docs" }
  ]
}

Subdirectories inside each path are automatically discovered as nested categories, up to three levels deep. See the routing reference for details on nested categories, page ordering, frontmatter fields, and draft pages.

Themes

Petit ships with 18 built-in themes. Set the theme option in your config:

{
  "theme": "claude"
}

See the themes reference for the full list, live previews, and customization options.

Search Documentation

Search for pages and content