Outline

The outline feature, also called grouping or dimension outline, groups rows or columns in a worksheet into collapsible groups, which makes large datasets easier to organize and summarize.

Introduction

In Univer Sheets, the outline feature supports the following operations:

  • Group rows or columns: Build hierarchical groups of rows or columns to organize the data.
  • Collapse and expand groups: Show or hide a group of rows or columns with a single click.
  • Nested groups: Create multiple levels of groups when the data has a deeper hierarchy.

Outline groups are commonly used in the following scenarios:

  • Summarizing detailed data: Group detailed rows under summary rows to produce a clearer view.
  • Organizing large datasets: Keep related columns or rows together so that they are easier to navigate.
  • Creating collapsible reports: Let users expand or collapse a section of a report as needed.

Plugin mode

Installation

Shell
pnpm add @univerjs-pro/sheets-outline @univerjs-pro/sheets-outline-ui

Usage

TypeScript
import { UniverSheetsOutlinePlugin } from '@univerjs-pro/sheets-outline'import { UniverSheetsOutlineUIPlugin } from '@univerjs-pro/sheets-outline-ui'import SheetsOutlineUIEnUS from '@univerjs-pro/sheets-outline-ui/locale/en-US'import { LocaleType, mergeLocales, Univer } from '@univerjs/core'import '@univerjs-pro/sheets-outline/facade'import '@univerjs-pro/sheets-outline-ui/lib/index.css'const univer = new Univer({  locale: LocaleType.EN_US,  locales: {    [LocaleType.EN_US]: mergeLocales(      SheetsOutlineUIEnUS,     ),  },})univer.registerPlugin(UniverSheetsOutlinePlugin)univer.registerPlugin(UniverSheetsOutlineUIPlugin)

If you have a commercial license for Univer, configure it as described in Using License in Client.

Mobile support

Configure the mobile editor first. In the plugin-mode setup on this page, replace the desktop registrations below with the mobile exports from the same packages, before opening a document. Keep the model plugins, styles, locales, and Facade imports, and do not register both variants.

PackageDesktop registrationMobile registration
@univerjs-pro/sheets-outline-uiUniverSheetsOutlineUIPluginUniverSheetsOutlineMobileUIPlugin

Preset mode

The outline feature is included in the @univerjs/preset-sheets-advanced preset.

Installation

Shell
pnpm add @univerjs/preset-sheets-advanced

Usage

TypeScript
import { UniverSheetsAdvancedPreset } from '@univerjs/preset-sheets-advanced'import UniverPresetSheetsAdvancedEnUS from '@univerjs/preset-sheets-advanced/locales/en-US'import { UniverSheetsCorePreset } from '@univerjs/preset-sheets-core'import UniverPresetSheetsCoreEnUS from '@univerjs/preset-sheets-core/locales/en-US'import { createUniver, LocaleType, mergeLocales } from '@univerjs/presets'import '@univerjs/preset-sheets-core/lib/index.css'import '@univerjs/preset-sheets-advanced/lib/index.css'const { univerAPI } = createUniver({  locale: LocaleType.EN_US,  locales: {    [LocaleType.EN_US]: mergeLocales(      UniverPresetSheetsCoreEnUS,      UniverPresetSheetsAdvancedEnUS,     ),  },  presets: [    UniverSheetsCorePreset(),    UniverSheetsAdvancedPreset(),   ],})

If you have a commercial license for Univer, configure it as described in Using License in Client.

Facade API

The full Facade API type definitions are in FacadeAPI.

Importing

Plugin mode note

The Facade package is imported manually only in plugin mode. Preset mode already includes the corresponding Facade package, so no additional import is required.

TypeScript
import '@univerjs-pro/sheets-outline/facade'

Creating row outlines

Create a row outline group with the Facade API:

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getActiveSheet()// Group rows 2 to 6 (0-based index: startRow=1, numRows=5)fWorksheet.addRowOutline(1, 5)

Creating column outlines

Column outlines are created in the same way:

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getActiveSheet()// Group columns B to E (0-based index: startColumn=1, numColumns=4)fWorksheet.addColumnOutline(1, 4)

Collapsing and expanding outlines

Groups can also be collapsed or expanded programmatically:

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getActiveSheet()const rowOutlines = fWorksheet.getDimensionOutlines(univerAPI.Enum.DimensionOutlineAxis.ROW)if (rowOutlines.length > 0) {  // Collapse the first row outline group  fWorksheet.setDimensionOutlineCollapsed(rowOutlines[0].id, true)  // Expand it later  fWorksheet.setDimensionOutlineCollapsed(rowOutlines[0].id, false)}

Removing outlines

Remove a single outline group by its ID:

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getActiveSheet()const rowOutlines = fWorksheet.getDimensionOutlines(univerAPI.Enum.DimensionOutlineAxis.ROW)if (rowOutlines.length > 0) {  fWorksheet.removeDimensionOutline(rowOutlines[0].id)}

Clearing outlines in a range

Clear all outline groups inside a range:

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getActiveSheet()// Remove all row outline groups fully contained in rows 2 to 10fWorksheet.clearDimensionOutlines(univerAPI.Enum.DimensionOutlineAxis.ROW, 1, 9)

Querying outlines

Read the outline groups that exist on a worksheet:

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getActiveSheet()// Get all row outlinesconst rowOutlines = fWorksheet.getDimensionOutlines(univerAPI.Enum.DimensionOutlineAxis.ROW)rowOutlines.forEach((outline) => {  console.log(outline.id, outline.start, outline.end, outline.collapsed)})// Get all outlines (both row and column)const allOutlines = fWorksheet.getDimensionOutlines()

Outline data structure

An outline group has the following properties:

PropertyTypeDescription
idstringUnique identifier for the outline group
unitIdstringThe workbook unit ID
subUnitIdstringThe worksheet sheet ID
axisDimensionOutlineAxisThe axis of the outline (row or column)
startnumberZero-based inclusive start index
endnumberZero-based inclusive end index
collapsedbooleanWhether the group is currently collapsed

Validation and errors

Creating an outline group performs the following checks:

  • Invalid range: The range must be valid, meaning non-negative and with a non-zero count.
  • Out of bounds: The range must remain within the worksheet boundaries.
  • Crossing groups: A new group cannot cross an existing group.
  • Maximum depth: Outline groups have a maximum nesting depth.

The range passed to ungrouping must fully contain the range of the outline group; otherwise the check fails.

When a check fails, the command does not run and the error is emitted through the SheetsOutlineErrorService.

How is this guide?

© 2026 DreamNum Co., Ltd.