Docs kit
@peleda-app/docs is a VitePress 2 theme with Vue components, coloured by the same theme engine as the React kits. This documentation is built with it.
Config
ts
// docs/.vitepress/config.ts
import { defineDocsConfig } from '@peleda-app/docs/config'
import { identity } from '@peleda-app/tokens/identities'
const id = identity('ui')
export default defineDocsConfig({
identity: id,
base: '/docs/',
outDir: '../dist/docs',
sitemap: { hostname: `${id.url}/docs/` },
themeConfig: {
sidebar: [{ text: 'Guide', items: [{ text: 'Overview', link: '/' }] }],
},
})ts
// docs/.vitepress/theme/index.ts
import theme from '@peleda-app/docs/theme'
export default themedefineDocsConfig takes a normal VitePress config plus identity (a site identity or any theme input) and tableLabel. It:
- generates the theme with
createThemeand inlines it as<style id="pl-docs-theme">, withtheme-colormeta tags for both schemes; - uses the identity's name and tagline as the default title and description, and
glyph nameas the site title; - turns on clean URLs, last-updated dates, local search, an outline of levels 2 and 3, external link icons and the GitHub light and dark code themes;
- isolates VitePress's own styles with PostCSS and wraps every Markdown table in a labelled, focusable scroll region named after the heading above it.
The theme extends VitePress's default theme without its fonts, registers every component globally and mirrors VitePress's dark mode onto data-theme on <html>.
Components
Usable directly in Markdown:
| Area | Components |
|---|---|
| Pages | DocsHero, DocsFeature, DocsButton, Card, CardGrid, LinkCard, Figure |
| Guides | Callout, Steps and Step, Tabs and TabItem, InstallTabs, CommandLine, CopyButton, FileTree and FileTreeItem |
| Reference | ApiEndpoint, MethodChip, ParamTable, PropsTable, SettingsLikeSection, SettingsRow, Badge, VersionTag, Since |
| Keyboard | Kbd, Shortcut |
| History | Changelog, ChangelogEntry, ChangelogChange |
md
<Callout type="warning" title="Back up first">
The migration rewrites the journal in place.
</Callout>Their stories are in the Docs namespace of the Storybook.