Skip to content

Tree Grid

Organize and edit nested resources without losing two-dimensional grid navigation.

Usage

Expanded rows

Inspect a project inventory whose nested applications and features remain visibly connected to their parents.

Project inventoryProduction workspace
4 resources
ResourceOwnerStatus
Commerce platformWorkspace
Platform team
Healthy
StorefrontApplication
Mina Kim
Modified
Checkout flowFeature
Alex Chen
In review
DocumentationContent
Technical writing
Published
Arrow keys move between cellsEnter edits · Alt + ←/→ folds

Editable cells

Edit the owner of a nested resource without leaving keyboard-based row and column navigation.

Project inventoryProduction workspace
4 resources
ResourceOwnerStatus
Commerce platformWorkspace
Platform team
Healthy
StorefrontApplication
Modified
Checkout flowFeature
Alex Chen
In review
DocumentationContent
Technical writing
Published
Editing Storefront ownerEnter edits · Alt + ←/→ folds

Controlled

Let the parent own the current value and apply accepted changes back to the component.

Project inventoryProduction workspace
4 resources
ResourceOwnerStatus
Commerce platformWorkspace
Platform team
Healthy
StorefrontApplication
Mina Kim
Modified
Checkout flowFeature
Alex Chen
In review
DocumentationContent
Technical writing
Published
Arrow keys move between cellsEnter edits · Alt + ←/→ folds

API

Vue package: @sectile/vue/tree-grid

Components
  • TreeGridRoot
  • TreeGridRow
  • TreeGridCell
  • TreeGridDisclosure
  • TreeGridEditor

Props

TreeGridRootProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

defaultEditMode

Initial uncontrolled editing mode.

defaultExpandedValue

Initially expanded values for uncontrolled state.

defaultHighlightedValue

Initially highlighted value for uncontrolled state.

defaultValue

Initial value used when the component owns its state.

disabled

Whether interaction is unavailable.

editMode

Controlled editing mode.

expandedValue

Controlled values whose descendants are visible.

getCellValue

Reads the editable value represented by a grid cell.

highlightedValue

Value currently highlighted for keyboard interaction.

modelValue

Current value when state is controlled by the parent.

policies

Behavior policies that customize validation, movement, or selection.

readonly

Whether the value can be inspected but not changed.

rows

Two-dimensional item structure managed by the component.

setCellValue

Commits a new editable value for a grid cell.

TreeGridPartProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

Slots

TreeGridRootSlotProps

disabled

Whether interaction is unavailable.

editMode

Current editing mode.

expandedValue

Values whose descendants are visible.

highlightedValue

Value currently highlighted for interaction.

readonly

Whether the value can be inspected but not changed.

value

Current value exposed by this contract.

TreeGridRowSlotProps

disabled

Whether interaction is unavailable.

editMode

Current editing mode.

expanded

Whether descendants are visible.

expandedValue

Values whose descendants are visible.

highlightedValue

Value currently highlighted for interaction.

readonly

Whether the value can be inspected but not changed.

value

Current value exposed by this contract.

TreeGridCellSlotProps

disabled

Whether interaction is unavailable.

editing

Whether editing is active.

editMode

Current editing mode.

expandedValue

Values whose descendants are visible.

highlighted

Whether this item is highlighted for interaction.

highlightedValue

Value currently highlighted for interaction.

readonly

Whether the value can be inspected but not changed.

selected

Whether this item is selected.

value

Current value exposed by this contract.

Events

TreeGridRoot

update:editMode

Emitted when the requested edit mode changes.

update:expandedValue

Emitted when the requested expanded values change.

update:highlightedValue

Emitted when the requested highlighted value changes.

update:modelValue

Emitted when the component requests a new controlled value.

Other types

TreeGridCellValueResolver

ts
type TreeGridCellValueResolver = NonNullable<TreeGridRootProps['getCellValue']>

TreeGridCellValueSetter

ts
type TreeGridCellValueSetter = NonNullable<TreeGridRootProps['setCellValue']>

TreeGridValueChangeHandler

ts
type TreeGridValueChangeHandler = (value: string | null) => void

TreeGridExpandedValueChangeHandler

ts
type TreeGridExpandedValueChangeHandler = (value: readonly string[]) => void

TreeGridHighlightedValueChangeHandler

ts
type TreeGridHighlightedValueChangeHandler = (value: string | null) => void

TreeGridEditModeChangeHandler

ts
type TreeGridEditModeChangeHandler = (value: TreeGridEditMode) => void

TreeGridEditMode

ts
type TreeGridEditMode = 'navigation' | 'editing'

TreeGridPolicies

NameTypeRequired
eligible(id: CellID) => boolean
boundaryAxisBoundaryPolicy
maxScannumber

TreeGridRowInput

NameTypeRequired
idRowIDYes
parentIDRowID | nullYes
cellsreadonly (CellID | null)[]Yes

Parts

Shared scope: [data-scope="tree-grid"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
root[data-part="root"]Defines the component boundary and owns its composed parts.
row[data-part="row"]Groups cells that belong to one grid row.
cell[data-part="cell"]Represents one navigable or selectable grid value.
disclosure[data-part="disclosure"]Expands or collapses child content.
editor[data-part="editor"]Edits the active grid or tree-grid cell.

Keyboard interaction

KeyBehavior
Arrow keysMove between grid cells.
SpaceSelect the current cell or row.
Enter / F2Enter edit mode when the current cell supports editing.
EscapeCancel the active edit.

Accessibility

Rows and cells expose hierarchy, position, expansion, selection, and edit state inside a labeled grid.

See the corresponding WAI-ARIA pattern for the host accessibility contract.

Released under the MIT License.