Skip to main content

MosaicRootActions

react-mosaic-component


react-mosaic-component / MosaicRootActions

Interface: MosaicRootActions<T>

Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:40

These actions are used to alter the state of the view tree

Type Parameters​

T​

T extends MosaicKey

Properties​

addTab​

addTab: (path, ...args) => Promise<void>

Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:75

Adds a new tab at path, dispatching on the node kind:

  • tab-group → append the new tab and make it active
  • leaf → replace the leaf with a 2-tab group containing the original and the new tab Rejects if createNode is not set, or if path resolves to a split node.

Parameters​

path​

MosaicPath

args​

...any[]

Returns​

Promise<void>


createNode?​

optional createNode?: CreateNode<T>

Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:67


expand​

expand: (path, percentage?) => void

Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:46

Increases the size of this node and bubbles up the tree

Parameters​

path​

MosaicPath

Path to node to expand

percentage?​

number

Every node in the path up to root will be expanded to this percentage

Returns​

void


getRoot​

getRoot: () => MosaicNode<T> | null

Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:114

Returns the root of this Mosaic instance

Returns​

MosaicNode<T> | null


hide​

hide: (path, suppressOnChange?) => void

Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:57

Hide the node at path but keep it in the DOM. Used in Drag and Drop

Parameters​

path​

MosaicPath

suppressOnChange?​

boolean

(default: false) - if true, won't trigger onChange event

Returns​

void


remove​

remove: (path) => void

Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:51

Remove the node at path

Parameters​

path​

MosaicPath

Returns​

void


removeTab​

removeTab: (path, index) => void

Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:83

Removes the tab at index from the tab-group at path. Adjusts activeTabIndex and normalizes the tree (collapsing a tab-group with a single remaining child back to a leaf). No-op if path doesn't resolve to a tab-group or the index is out of range.

Parameters​

path​

MosaicPath

index​

number

Returns​

void


replaceWith​

replaceWith: (path, node, meta?) => void

Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:91

Replace currentNode at path with node

Parameters​

path​

MosaicPath

node​

MosaicNode<T>

meta?​

MosaicChangeMeta<T>

(default: { type: 'replace', path, node, previous }) - passed to onChange / onRelease

Returns​

void


show​

show: (path, suppressOnChange?) => void

Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:65

Show a previously hidden node. This is used to restore a component if a drag operation is cancelled.

Parameters​

path​

MosaicPath

suppressOnChange?​

boolean

(default: false) - if true, won't trigger onChange event

Returns​

void


updateTree​

updateTree: (updates, modifiers?) => void

Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:102

Atomically applies all updates to the current tree

Parameters​

updates​

MosaicUpdate<T>[]

modifiers?​
meta?​

MosaicChangeMeta<T>

(default: { type: 'update' }) - passed to onChange / onRelease

shouldNormalize?​

boolean

suppressOnChange?​

boolean

suppressOnRelease?​

boolean

(default: false)

Returns​

void