Content Controls

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

Shell
pnpm add @univerjs-pro/docs-sdt @univerjs-pro/docs-sdt-ui
TypeScript
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 applies to the active text selection. When the control type supports it, the current selection is wrapped into the new control. Repeating-section items are created through their parent section.

TypeScript
import { InsertSdtCommand } from '@univerjs-pro/docs-sdt-ui'await univerAPI.executeCommand(InsertSdtCommand.id, { kind: 'checkbox' })

Locks and persistence

Controls are stored in IDocumentBody.customRanges as CustomRangeType.SDT ranges, and their metadata is stored in ISdtCustomRange.properties. A content lock prevents value edits, and a control lock prevents removal of the wrapper. A repeating section can also disallow inserting and deleting items. Change values, properties, and repeating items through commands so that undo and redo remain consistent.

See the model commands and UI API reference pages. DOCX conversion is handled by Exchange; editor support does not mean that every Word property or custom XML binding converts without loss.

How is this guide?

© 2026 DreamNum Co., Ltd.