import { ApiSurfaceReference } from "@pixxl-tools/components";
// In Server Components:
import { ApiSurfaceReference } from "@pixxl-tools/components/server";| Prop | Type | Default | Description |
|---|---|---|---|
surface (required) | ApiSurfaceReferenceDoc | — | Generated docs-engine surface (signature, examples, exports, option groups, type references). |
codeMaxHeight | { declaration?: number | string; output?: number | string; source?: number | string } | — | Collapse long code: source (example code), output (example output), declaration (exports, types, option groups). Unset: never collapse. |
exampleTitle | (id: string) => ReactNode | — | Visible title of an example (heading and related-example links); default its id. |
exampleLanguage | string | ts | Language of the example code (default ts). |
labels | Partial<Record<ApiSurfaceReferenceLabel, ReactNode>> | — | Override catalog labels (section headings, Source / Output, related examples). |
navigationLabel | string | — | Accessible name of the section navigation (default from AnchorNav). |
notice | ReactNode | — | Shown above the signature (e.g. an Alert about a pre-release). |
renderExamples | (examples: ApiSurfaceReferenceDoc["examples"]) => ReactNode | — | Replace the default examples list (source + output per example). |
surfacerequiredApiSurfaceReferenceDoc
Generated docs-engine surface (signature, examples, exports, option groups, type references).
codeMaxHeight{ declaration?: number | string; output?: number | string; source?: number | string }
Collapse long code: source (example code), output (example output), declaration (exports, types, option groups). Unset: never collapse.
exampleTitle(id: string) => ReactNode
Visible title of an example (heading and related-example links); default its id.
exampleLanguagedefault tsstring
Language of the example code (default ts).
labelsPartial<Record<ApiSurfaceReferenceLabel, ReactNode>>
Override catalog labels (section headings, Source / Output, related examples).
navigationLabelstring
Accessible name of the section navigation (default from AnchorNav).
noticeReactNode
Shown above the signature (e.g. an Alert about a pre-release).
renderExamples(examples: ApiSurfaceReferenceDoc["examples"]) => ReactNode
Replace the default examples list (source + output per example).
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
plot(data: Point[], settings?: Settings): stringplot([[1, 1], [2, 4], [3, 9]], { height: 4 });basic: Source 9 ┤ ╭
4 ┤╭─╯
1 ┼╯basic: OutputplotDraws a chart as text.
function plot(data: Point[], settings?: Settings): stringplotPointOne data point.
type Point = type Point = [x: number, y: number];PointSettings// The surface JSON that docs-engine generates for your API.
import surface from "./generated/plot.json";
const titles: Record<string, string> = { basic: "Basic chart" };
<ApiSurfaceReference surface={surface} exampleTitle={(id) => titles[id] ?? id} codeMaxHeight={{ output: 320 }} />