Usage
<OptionField> is the right tool for CLI flags, env vars, and generic configuration knobs — anything that's "an option the user sets" but isn't a path/query/body/header HTTP parameter.
<OptionField name="--port" short="-p" type="number" default="4242">
Port to bind the local dev server to.
</OptionField>
<OptionField name="--host" type="string" default="localhost">
Host interface to bind. Set to `0.0.0.0` to expose on your LAN.
</OptionField>--port-pnumberdefault: 4242Port to bind the local dev server to.
--hoststringdefault: localhostHost interface to bind. Set to 0.0.0.0 to expose on your LAN.
With short alias
CLI flags commonly have a short form (single-dash + single-letter). Pass it as short:
<OptionField name="--verbose" short="-v" type="boolean" default="false">
Print every sync step instead of just errors.
</OptionField>--verbose-vbooleandefault: falsePrint every sync step instead of just errors.
With an example
Pass example to render a small code fence below the description — useful for showing exact invocation:
<OptionField
name="--port"
short="-p"
type="number"
default="4242"
example="nookdocs dev --port 5173"
>
Port to bind the local dev server to.
</OptionField>--port-pnumberdefault: 4242Port to bind the local dev server to.
nookdocs dev --port 5173
With an enum
Pass enum when the option accepts a closed set of values:
<OptionField name="--log-level" type="string" default='"info"' enum={["debug", "info", "warn", "error", "silent"]}>
How verbose logging should be.
</OptionField>--log-levelstringdefault: "info"How verbose logging should be.
debuginfowarnerrorsilentRequired and deprecated
<OptionField name="--project-id" type="string" required>
The NookDocs project ID. Required for CI workflows.
</OptionField>
<OptionField name="--legacy-mode" type="boolean" deprecated>
Enabled the pre-v2 renderer. Removed in v3 — the renderer is always the new one.
</OptionField>--project-idstringrequiredThe NookDocs project ID. Required for CI workflows.
--legacy-modebooleandeprecatedEnabled the pre-v2 renderer. Removed in v3 — the renderer is always the new one.
When to use OptionField vs ParamField
<OptionField> | <ParamField> | |
| Purpose | CLI flag, env var, config knob | HTTP request parameter |
| Location badges | No (options don't have path/query/body/header) | Yes |
| Short alias | Yes (short="-p") | No |
| Example snippet | Yes (renders a code block) | No (use placeholder instead) |
If you're documenting an HTTP API, use <ParamField>. If you're documenting a CLI, nookdocs.config.json field, or an env variable, use <OptionField>.
Props
| Prop | Type | Required | Description |
name | string | Yes | The option as the user types it, e.g. "--port" or "API_KEY" |
short | string | No | Short-form alias, e.g. "-p" |
type | string | No | Type annotation ("number", "boolean", "string[]") |
required | boolean | No | Red "required" badge |
default | string | No | Default value shown inline |
deprecated | boolean | No | Strike-through + "deprecated" badge |
enum | readonly string[] | No | Closed value set — rendered as chips |
example | string | No | Example invocation rendered as a code fence |
children | ReactNode | No | Description markdown — paragraphs, lists, code |