API reference
A reference page for API endpoints or MCP tools with scope, minimum role, an arguments table, an example call and result, and a card catalog of all tools.
Code
<ApiReference tools={[ { id: "create_issue", name: "create_issue", summary: "Create an issue in a project.", category: "Issues", scope: "issues:write", minRole: "Member", access: "write", args: [{ name: "title", type: "string", required: true, description: "Short title." }], examples: [{ call: '{ "title": "Fix login" }', result: '{ "id": "MH-1" }' }], }, ]}/>Developer Tools · beta
Live examples and controls: API reference in the lab.
Install
npx shadcn@latest add https://docs.nasaqui.com/r/api-reference.jsonA docs page for the things a caller can invoke. A searchable list sits beside the selected tool: its name, scope, minimum role, access level, an arguments table and an example call with its result. A second view shows every tool as a card, grouped by category. It renders the data you pass; generate it from your schema.
When to use
- Documenting an MCP server's tools or a REST API inside your product.
When not to use
- Long prose docs: use a docs layout with markdown.
- Trying calls live: this page only shows examples.
Import
import { ApiReference } from "@fadymondy/nasaq/web";
// inside this monorepo: "@nasaq/web"Quick start
<ApiReference
tools={[
{
id: "create_issue",
name: "create_issue",
summary: "Create an issue in a project.",
category: "Issues",
scope: "issues:write",
minRole: "Member",
access: "write",
args: [{ name: "title", type: "string", required: true, description: "Short title." }],
examples: [{ call: '{ "title": "Fix login" }', result: '{ "id": "MH-1" }' }],
},
]}
/>Anatomy
ApiReference data-slot="api-reference"
├─ toolbar search, category chips, access filter, Reference/Catalog switch
├─ list tools grouped by category
└─ ApiToolDetail name, badges, scope, min role, args Table, examples in CodeBlock
ApiToolCatalog card grid of toolsAPI
| Prop | Type | Default | Description |
|---|---|---|---|
tools | ApiTool[] | required | { id, name, summary, description?, category?, scope, minRole, access?, args?, returns?, examples?, deprecated?, since? }. |
selectedId? / onSelectedChange? | string / (id) => void | first tool | Controlled selection. |
view? / defaultView? / onViewChange? | "reference" | "catalog" | "reference" | Which view shows. |
labels? | Partial<ApiReferenceLabels> | en/ar | Override any string. |
ApiToolDetail takes tool; ApiToolCatalog takes tools and onSelect?. ApiArg is { name, type, required?, description?, default?, values? }; ApiExample is { title?, call, result, callLanguage?, resultLanguage? }.
Examples
Catalog first
<ApiReference tools={tools} defaultView="catalog" />Accessibility
- The list is a labelled navigation of buttons with
aria-currenton the open tool. The switch and filters are named groups. - Access level is written out (Read, Write, Destructive), not colour alone. Required arguments say "required".
- On small screens the list and detail swap with a Back button; focus moves to the heading.
RTL & i18n
- English and Arabic built in. Tool names, scopes, types, defaults and code stay left-to-right in
<bdi dir="ltr">; the code blocks are always left-to-right. - Search folds Arabic letter variants. Localise
categoryandminRolein your data.
Styling & tokens
bg-card,border-border,rounded-card; code uses theCodeBlocktokens. No raw hex.- Target
[data-slot=api-reference].
Do / Don't
- Do give every example both a call and a result.
- Do mark destructive tools so the badge warns before use.
- Don't put secrets in examples.
Related
Lab
https://docs.nasaqui.com/?path=/docs/components-developer-tools-api-reference--docs
ApiKeys
API key management with a create form (name, scopes, expiry), a one-time secret reveal with copy, a masked list with scopes and last used, and confirmed rotate and revoke, driven by async callbacks.
CodeBlock
Syntax-highlighted code with filename header, line numbers, highlighted lines and a copy button; Shiki loads lazily. Also InlineCode.