--- title: Write reference pages description: How to create API reference pages for the Video.js documentation site --- import Aside from '@/components/Aside.astro'; import DocsLink from '@/components/docs/DocsLink.astro'; This guide covers how to create API reference pages — both component references and util references (hooks, controllers, mixins) under `reference/` in the docs sidebar. ## Prerequisites Before creating a reference page, the component must exist in: - **Core**: `packages/core/src/core/ui/{name}/{name}-core.ts` (props, state, behavior) - **HTML**: `packages/html/src/ui/{name}/` (custom element) - **React**: `packages/react/src/ui/{name}/` (React component) The component should be feature-complete enough that its props, state, and data attributes are stable. ## Generate the API reference JSON The api-docs-builder extracts type information from TypeScript sources and outputs JSON files that `` and `` components render as tables. ```bash pnpm -F site api-docs ``` This generates JSON to `site/src/content/generated-component-reference/{name}.json` and `site/src/content/generated-util-reference/{name}.json`. These files are gitignored and regenerated automatically on `pnpm dev` and `pnpm build`. ### Builder naming conventions The builder relies on file naming conventions to discover components: | Convention | Pattern | Example | |------------|---------|---------| | Core file | `{name}-core.ts` | `play-button-core.ts` | | Data attrs | `{name}-data-attrs.ts` | `play-button-data-attrs.ts` | | HTML element | `{name}-element.ts` | `play-button-element.ts` | | React component | `packages/react/src/ui/{name}/` | `packages/react/src/ui/play-button/` | | Multi-part detection | `index.parts.ts` | `packages/react/src/ui/slider/index.parts.ts` | If the builder output is missing or incomplete, check that your files match these conventions. See `.agents/skills/write-api-reference/references/builder-conventions.md` for the full list. ## Create demo files Each reference page needs at least a BasicUsage demo in both HTML and React. ### HTML demo (4 files) ``` src/components/docs/demos/{name}/html/css/ ├── BasicUsage.astro # Wrapper: imports CSS, renders HTML, bundles script ├── BasicUsage.html # Markup only (no