---
url: /reference/interface/ui-components/box.md
---
# Box

`Box` 是基础布局容器，用于包裹内容，并通过 class 控制内边距、背景等样式。

## 使用

::: code-group

```ts [Angular]
import { NxBox } from "@pc-nexus/angular";
```

```ts [React]
import { NxBox } from "@pc-nexus/react";
```

:::

## 属性

:::comp-props

| 名称   | 类型     | 必填 | 描述                         |
| ------ | -------- | ---- | ---------------------------- |
| `role` | `string` |      | 无障碍角色，对应 HTML `role` |

:::

## 示例

### Basic

`Box` 是一种通用容器，能够实现对设计元素的控制使用，利用提供的样式 class 白名单，使其与 PingCode 设计系统保持一致。

:::demo src=box-basic
:::

### Background

通过 `bg-*` 等 class 设置背景色。

:::demo src=box-background
:::

### Padding

通过 `p-2`、`p-3`、`p-4` 等 class 设置内边距。

:::demo src=box-padding
:::
