MosaicRootActions
react-mosaic-component / MosaicRootActions
Interface: MosaicRootActions<T>
Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:36
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:71
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
createNodeis not set, or ifpathresolves to a split node.
Parameters
path
args
...any[]
Returns
Promise<void>
createNode?
optionalcreateNode?:CreateNode<T>
Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:63
expand
expand: (
path,percentage?) =>void
Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:42
Increases the size of this node and bubbles up the tree
Parameters
path
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:103
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:53
Hide the node at path but keep it in the DOM. Used in Drag and Drop
Parameters
path
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:47
Remove the node at path
Parameters
path
Returns
void
removeTab
removeTab: (
path,index) =>void
Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:79
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
index
number
Returns
void
replaceWith
replaceWith: (
path,node) =>void
Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:86
Replace currentNode at path with node
Parameters
path
node
MosaicNode<T>
Returns
void
show
show: (
path,suppressOnChange?) =>void
Defined in: libs/react-mosaic-component/src/lib/contextTypes.ts:61
Show a previously hidden node. This is used to restore a component if a drag operation is cancelled.
Parameters
path
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:92
Atomically applies all updates to the current tree
Parameters
updates
MosaicUpdate<T>[]
modifiers?
shouldNormalize?
boolean
suppressOnChange?
boolean
suppressOnRelease?
boolean
Returns
void