> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiIzODgzMGEzZi0zZGJjLTQ0NWQtOTMyYS0wZmNkZjllNzgyZDAiLCJleHAiOjE3NzgyNjM4NDgsImlhdCI6MTc3ODI2MzU0OH0.Eb7v7jypTHqKXmz0m1jsOQD_qjTauYlkPhl7aNeNlyY
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# 参数字段

> 学习如何使用 Fern 的 ParamField 组件记录 API 参数。一致地格式化类型、要求、默认值和描述。

ParamField 组件记录 API 参数和属性，为类型、要求、默认值和描述提供一致的格式。

## 用法

<div>
  <div>
    <ParamField path="username" type="string" required={true}>
      用户的显示名称
    </ParamField>

    <ParamField path="limit" type="number" default="50">
      要返回的最大项目数
    </ParamField>
  </div>
</div>

```jsx Markdown
<ParamField path="username" type="string" required={true}>
  用户的显示名称
</ParamField>

<ParamField path="limit" type="number" default="50">
  要返回的最大项目数
</ParamField>
```

## 变体

### 已弃用的参数

<div>
  <div>
    <ParamField path="api_key" type="string" deprecated={true}>
      请改用 OAuth 身份验证
    </ParamField>
  </div>
</div>

```jsx Markdown
<ParamField path="api_key" type="string" deprecated={true}>
  请改用 OAuth 身份验证
</ParamField>
```

### 联合类型

<div>
  <div>
    <ParamField path="status" type="'active' | 'inactive' | 'pending'" default="active">
      用户账户的当前状态
    </ParamField>
  </div>
</div>

```jsx Markdown
<ParamField path="status" type="'active' | 'inactive' | 'pending'" default="active">
  用户账户的当前状态
</ParamField>
```

## 属性

<ParamField path="path" type="string" required={false}>
  参数的名称（例如，"username"、"limit"）
</ParamField>

<ParamField path="type" type="string" required={true}>
  参数的数据类型（例如，"string"、"number"、"boolean"）
</ParamField>

<ParamField path="required" type="boolean" required={false}>
  指示参数是否为必需。当为 true 时显示"必需"标签。
</ParamField>

<ParamField path="default" type="string" required={false}>
  参数的默认值（如果有）
</ParamField>

<ParamField path="deprecated" type="boolean" required={false}>
  将参数标记为已弃用。
</ParamField>

<ParamField path="toc" type="boolean" required={false}>
  是否在目录中包含该参数。默认为 `false`。
</ParamField>