viabl
Theme
Components

ResponseField

Document API response fields with name, type, and description in a structured layout.

Overview

The ResponseField component renders a single field in an API response schema. Each entry displays the field name, its type, an optional required badge, and a description. Stack multiple ResponseField components to document a full response object.


Example

idstringrequired

The unique identifier for the resource.

created_atstring

ISO 8601 timestamp of when the resource was created.

metadataobject

An optional key-value map of additional data attached to the resource.


Usage

Basic field

mdx
<ResponseField name="id" type="string">
  The unique identifier for the resource.
</ResponseField>

Required field

mdx
<ResponseField name="email" type="string" required>
  The email address of the user. Must be unique across all accounts.
</ResponseField>

Full response object

Stack multiple entries to document a complete response schema:

mdx
    <ResponseField name="id" type="string" required>
    Unique identifier for the user.
    </ResponseField>
 
    <ResponseField name="name" type="string" required>
    Full display name of the user.
    </ResponseField>
 
    <ResponseField name="email" type="string" required>
    Email address associated with the account.
    </ResponseField>
 
    <ResponseField name="role" type="'admin' | 'member' | 'viewer'">
    The user's permission level within the workspace.
    </ResponseField>
 
    <ResponseField name="created_at" type="string">
    ISO 8601 timestamp of when the account was created.
    </ResponseField>
 
    <ResponseField name="metadata" type="object">
    Optional key-value pairs of additional data attached to the user.
    </ResponseField>
 

Props

PropTypeRequiredDescription
namestringYesThe field name displayed in monospace.
typestringYesThe field's type annotation, e.g. string, number, object.
requiredbooleanNoWhen present, displays a red required badge next to the type.
childrenReact.ReactNodeYesDescription of the field and its expected values or behavior.

Accessibility Notes

  • Field names and types are rendered in <code> and monospace text for clarity.
  • The required badge uses both color and text to convey requirement status — it is not color-only.
  • For deeply nested response schemas, consider using ResponseField alongside Expandable to progressively disclose nested fields.
Was this page helpful?