> ## Documentation Index
> Fetch the complete documentation index at: https://docs.holydocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Schema

Expandable JSON Schema and object explorer with type chips, required markers, defaults, examples, and nested structures.

**Interactive playground** For isolated previews, theme switching, and sandbox editing, open [the Schema playground on holydocs.com](https://holydocs.com/components/schema).

## When to use

Use this component when endpoint documentation needs explicit request, response, schema, or lifecycle metadata.

## Live Examples

Every example below renders the real component directly inside HolyDocs, followed by the exact MDX you can paste into a page.

### Nested Response

Structured object with examples and nested arrays.

**Project response schema**

~~~mdx
<Schema
  title="Project response schema"
  rootName="project"
  schema={{
    "type":"object",
    "required":["id","name","members"],
    "properties":{
      "id":{"type":"string","format":"uuid","description":"Unique project identifier.","example":"proj_123"},
      "name":{"type":"string","description":"Display name for the project.","minLength":3,"maxLength":64},
      "visibility":{"type":"string","enum":["private","public"],"default":"private"},
      "members":{"type":"array","description":"Project members with roles.","items":{"type":"object","required":["email","role"],"properties":{
        "email":{"type":"string","format":"email"},
        "role":{"type":"string","enum":["owner","editor","viewer"]},
        "lastSeenAt":{"type":"string","format":"date-time","nullable":true}
      }}}
    }
  }}
/>
~~~

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `schema` | `JSON` | `{}` | Parsed JSON Schema object or plain JSON object. |
| `title` | `string` | `--` | Optional title shown above the schema block. |
| `rootName` | `string` | `root` | Name shown for the root schema node. |

## Usage

Start from this baseline shape and then tailor the copy, data, or nesting to the page you are writing.

~~~mdx
<Schema
  title="Project response schema"
  rootName="project"
  schema={{
    "type":"object",
    "required":["id","name","members"],
    "properties":{
      "id":{"type":"string","format":"uuid","description":"Unique project identifier.","example":"proj_123"},
      "name":{"type":"string","description":"Display name for the project.","minLength":3,"maxLength":64},
      "visibility":{"type":"string","enum":["private","public"],"default":"private"},
      "members":{"type":"array","description":"Project members with roles.","items":{"type":"object","required":["email","role"],"properties":{
        "email":{"type":"string","format":"email"},
        "role":{"type":"string","enum":["owner","editor","viewer"]},
        "lastSeenAt":{"type":"string","format":"date-time","nullable":true}
      }}}
    }
  }}
/>
~~~

## Tips

- Keep naming and ordering consistent across fields, examples, and lifecycle notes so readers do not have to re-parse the endpoint surface on every page.
- Document the happy path and the sharp edges together. Request shape alone is not enough without auth, errors, and retry guidance.
- If a component renders into the right panel, verify the page on desktop width so you can confirm the supporting example is visible where readers expect it.

## Related Components

**[ParamField](/components/param-field)**

Documents a request parameter — path, query, or body — with type, requirement status, and description.
**[ResponseField](/components/response-field)**

Documents a field in an API response body with its name, type, and description.
**[Expandable](/components/expandable)**

Collapsible section for nested API fields, keeping complex response shapes readable.

## More

- Interactive playground: [Schema on holydocs.com](https://holydocs.com/components/schema)
- Component library index: [/components](/components)