Skip to content

ApiField

The <ApiField> component is the workhorse of your documentation. It is designed to cleanly display the keys, types, and descriptions of complex data objects and schemas.

You can use the component by importing it at the top of your .mdx file.

import ApiField from '@/components/docs/ApiField.astro';
&lt;ApiField name="user_id" type="string" required&gt;
The unique identifier for the user account.
&lt;/ApiField&gt;
user_id string
Required

The unique identifier for the user account. Must be a valid UUID v4.

preferences object
Default: {} Optional

A nested object containing the user’s notification and theme settings.

PropTypeRequiredDescription
namestringYesThe name of the parameter or key.
typestringYesThe data type (e.g., string, number, boolean, Array<string>).
requiredbooleanNoIf true, displays a red “REQUIRED” badge. Defaults to false (displays “OPTIONAL”).
defaultValuestringNoRenders a small tag showing the default value if the key is omitted.