Theme
Customize the Tailwind CSS v4 default theme, color tokens, dark mode, navigation, and homepage layout.
The default theme ships inside the svedocs package. It uses Tailwind CSS v4 and framework CSS variables, so there is no separate theme package to install.
Styles
Import the theme stylesheet from the SvelteKit root layout:
Sveltesrc/routes/+layout.svelte<script> import 'svedocs/theme/styles.css'; </script> <slot />
The stylesheet defines --sd-* tokens and uses data-theme for light and dark mode.
Palette
TypeScriptsvedocs.config.tsimport { defineConfig } from 'svedocs/config'; export default defineConfig({ theme: { defaultMode: 'system', palette: { accent: 'emerald', neutral: 'zinc' }, fonts: { sans: '"IBM Plex Sans", "Avenir Next", sans-serif', mono: '"JetBrains Mono", "SFMono-Regular", monospace', display: '"IBM Plex Sans", "Avenir Next", sans-serif' }, radius: '2px', codeTheme: { light: 'light-plus', dark: 'dark-plus' }, brand: { label: 'svedocs', href: '/', mark: 'pixel' }, nav: [ { label: 'Docs', href: '/docs' }, { label: 'Configuration', href: '/docs/configuration' }, { label: 'API', href: '/docs/reference/api' } ], social: [ { label: 'GitHub', href: 'https://github.com/svedocs/svedocs', external: true } ], footer: { text: 'MIT licensed.', links: [{ label: 'Cloudflare', href: '/docs/integrations/cloudflare' }] }, home: { kicker: 'Edge-first Svelte docs', primaryAction: { label: 'Read docs', href: '/docs' }, secondaryAction: { label: 'Configure', href: '/docs/configuration' }, visual: { type: 'pixel' } } } });
palette.accent accepts a built-in token such as emerald, sky, indigo, or a CSS color value. The default theme keeps the palette restrained and documentation-focused.
home.visual can stay as the built-in pixel module or point at a project image with { type: 'image', src: '/hero.png', alt: 'Preview' }.
Interaction
Built-in theme behavior includes:
- Search dialog with keyboard focus management.
- Ask AI panel with JSON and event-stream responses.
- Command palette for docs, search, and Ask AI entry points.
- Recursive sidebar with collapsed groups and locale-scoped trees.
- Mobile menu state with transition.
- ToC highlighting based on the active heading.
- Code block toolbar with copy support.
prefers-reduced-motioncompatible transitions.
Single pages
Content under content/pages renders through the built-in single-page template by default. Use layout: home for the homepage, layout: page for the built-in page template, or a registered custom layout name for project-specific pages.
Markdown--- title: Changelog description: Product updates rendered with the single-page template. --- # Changelog
Custom layouts
Register named layouts in the Vite plugin:
TypeScriptvite.config.tssvedocs({ layouts: { feature: '$lib/FeatureLayout.svelte' } });
Then select a layout in frontmatter:
Markdown--- title: Feature Page layout: feature ---
Layouts receive the same page data as default pages, so custom single pages can still use the manifest, search records, SEO metadata, and framework shell.