Skip to main content

API docs

OptionField

Document a CLI flag, command-line option, or configuration knob — sibling of ParamField for things that aren't HTTP request params.

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: 4242

Port to bind the local dev server to.

--hoststringdefault: localhost

Host 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: false

Print 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: 4242

Port 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.

options:debuginfowarnerrorsilent

Required 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-idstringrequired

The NookDocs project ID. Required for CI workflows.

--legacy-modebooleandeprecated

Enabled the pre-v2 renderer. Removed in v3 — the renderer is always the new one.

When to use OptionField vs ParamField

<OptionField><ParamField>
PurposeCLI flag, env var, config knobHTTP request parameter
Location badgesNo (options don't have path/query/body/header)Yes
Short aliasYes (short="-p")No
Example snippetYes (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

PropTypeRequiredDescription
namestringYesThe option as the user types it, e.g. "--port" or "API_KEY"
shortstringNoShort-form alias, e.g. "-p"
typestringNoType annotation ("number", "boolean", "string[]")
requiredbooleanNoRed "required" badge
defaultstringNoDefault value shown inline
deprecatedbooleanNoStrike-through + "deprecated" badge
enumreadonly string[]NoClosed value set — rendered as chips
examplestringNoExample invocation rendered as a code fence
childrenReactNodeNoDescription markdown — paragraphs, lists, code
Was this page helpful?

Last updated August 7, 2026