| title | Contributing docs | ||
|---|---|---|---|
| description | How to add a new component page and sidebar entry in this VitePress site. | ||
| outline |
|
For the full workflow, folder conventions, and a copy-paste agent prompt for new primitives, see Component authoring.
- Create the page in the matching category path:
docs/components/form/<slug>.mddocs/components/containment/<slug>.mddocs/components/navigation/<slug>.mddocs/components/feedback/<slug>.md(when applicable)docs/components/<slug>.mdfor top-level primitives/layout docs
- Copy structure from
.vitepress/templates/component-template.mdin the docs folder. - Add a sidebar item in
.vitepress/config.tsunderthemeConfig.sidebar['/components/']in the matching group. - Add a row to
docs/components/index.mdin the right section. - Add
DemoGk*.vueunder.vitepress/components/demos/...mirroring category paths, register in.vitepress/theme/index.ts, and embed<DemoGk… />in the page.
The docs theme includes a right-side drawer opened from the header (Kit settings next to the nav). It is implemented in docs/.vitepress/components/GkDocsKitDrawer.vue and docs/.vitepress/theme/gk-kit-export.ts. Live preview covers theme (useGkTheme), CSS design tokens (radius, motion, focus, opacity), and density; display, locale, and component defaults only shape the copied export. When changing drawer behavior or export shape, update those files and keep the god-kit/vue/config Vite alias before god-kit/vue in docs/.vitepress/config.ts.
- Use frontmatter:
title,description,outline: [2, 3]. - Canonical sections (in order):
- Overview
- When to use
- Live demo
- API (props/events/slots/tokens)
- Examples (
Basic,Advanced,Edge case) - Accessibility notes
- Related components
- Sample taxonomy:
- Basic: minimal happy path
- Advanced: realistic app integration
- Edge case: disabled/readonly/loading/error/RTL/keyboard-focused
- Use
GkDocsExamplefor copy-paste samples that need a live preview and source code shown under the preview. Prefer one standalone sample component plus a?rawimport for its source (for example, importGkCardBasicExample.vueandGkCardBasicExample.vue?raw) so the rendered demo and copied code cannot drift. - Use
GkDocsCodeBlockfor standalone copyable snippets, generated playground code, or short recipes outside a full preview. It supports syntax highlighting, collapsed long snippets, expand/collapse, and copy state. - For editable examples, prefer a small docs playground with form controls and generated code before adding a browser SFC compiler or heavy editor dependency.
- Use live demos for interactive behavior; use markdown code fences only for concise API notes that do not need copy buttons.
Before merging sample updates:
- Page follows canonical section order.
- At least one live demo is embedded.
- Includes one advanced and one edge-case snippet (or explicit reason why not applicable).
- Copyable examples use
GkDocsExampleorGkDocsCodeBlockand import sample source with?rawwhere possible instead of duplicating code in markdown or string constants. - Editable playgrounds generate copyable code from current state instead of executing arbitrary user-provided SFC code.
- Accessibility notes cover keyboard/labels/state semantics when relevant.
- Related components section links to adjacent primitives.
- Sidebar +
docs/components/index.md+ theme demo registration are kept in sync. -
npm run docs:buildandnpm run testpass locally.
When you ship user-facing changes, add an entry under [Unreleased] in CHANGELOG.md at the package root (next to package.json), then move items into a dated version when you release. Keep docs/guide/changelog.md in sync (same sections) so the VitePress site matches the repo file.
For bugs, features, and other topics, use the GitHub issue templates (Bug report, Feature request, Other / discussion).
Run node scripts/new-component.mjs <kebab-name> [form|layout] from the god-kit package root. The optional second argument places the primitive under src/vue/components/form/ or src/vue/components/layout/ and writes docs/demos under matching paths. Without it, files go under src/vue/components/<name>/ (e.g. GkButton). You still wire src/vue/index.ts, docs/.vitepress/theme/index.ts, the sidebar in config.ts, docs/components/index.md, and CHANGELOG.md.
You can generate the Components sidebar from the filesystem with a small build script; until then, keep the sidebar list in sync by hand when adding pages.
The public CLI architecture, project detection matrix, and idempotency contract are documented in CLI architecture.
- Assign a rotating docs owner each release.
- Run a monthly sample audit for high-traffic primitives (
GkInput,GkButton,GkTabs,GkMenu,GkDialog,GkPagination).