# Content Controls

- Human documentation: [https://docs.univer.ai/guides/docs/features/content-controls](https://docs.univer.ai/guides/docs/features/content-controls)

- Agent Markdown: [https://docs.univer.ai/guides/docs/features/content-controls.md](https://docs.univer.ai/guides/docs/features/content-controls.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0`

- Source: [docs/features/content-controls.mdx](https://github.com/dream-num/documentation/blob/dev/content/guides/docs/features/content-controls.mdx)

---

Content controls (SDT) support rich text, plain text, checkboxes, dates, lists, pictures, groups, repeating sections, and document parts. Register the Docs core and Pro license plugins, then the two packages below before creating the document. Merge the UI locale into `locales` and load the stylesheet. The Docs advanced preset does not include these packages.

#### npm

```bash
npm install @univerjs-pro/docs-sdt @univerjs-pro/docs-sdt-ui
```

#### pnpm

```bash
pnpm add @univerjs-pro/docs-sdt @univerjs-pro/docs-sdt-ui
```

#### yarn

```bash
yarn add @univerjs-pro/docs-sdt @univerjs-pro/docs-sdt-ui
```

#### bun

```bash
bun add @univerjs-pro/docs-sdt @univerjs-pro/docs-sdt-ui
```

```ts
import { UniverDocsSdtPlugin } from '@univerjs-pro/docs-sdt'
import { UniverDocsSdtUIPlugin } from '@univerjs-pro/docs-sdt-ui'
import FeatureLocale from '@univerjs-pro/docs-sdt-ui/locale/en-US'
import { LocaleType } from '@univerjs/core'

import '@univerjs-pro/docs-sdt-ui/lib/index.css'

univerAPI.loadLocales(LocaleType.EN_US, FeatureLocale)

univer.registerPlugin(UniverDocsSdtPlugin)
univer.registerPlugin(UniverDocsSdtUIPlugin)
```

## Insert at the selection

The command uses the active text selection. Existing selected content is wrapped where the control supports it. Repeating-section items are created through their parent section.

```ts
import { InsertSdtCommand } from '@univerjs-pro/docs-sdt-ui'

await univerAPI.executeCommand(InsertSdtCommand.id, { kind: 'checkbox' })
```

## Locks and persistence

Controls are stored as `CustomRangeType.SDT` ranges in `IDocumentBody.customRanges`, with metadata in `ISdtCustomRange.properties`. Content locks prevent value edits; control locks prevent wrapper removal. Repeating sections can disallow item insertion and deletion. Use commands for value, property, and repeating-item changes so undo/redo remains consistent.

See the [model commands](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-sdt.md) and [UI API](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-sdt-ui.md). DOCX conversion belongs to [Exchange](https://docs.univer.ai/guides/docs/features/import-export.md); editor support does not imply lossless support for every Word property or custom XML binding.
