Components
Mosyn exposes two components for building a dashboard: MosynManager and Mosyn.
MosynManager
Section titled “MosynManager”Wrap every grid that should participate in the same dashboard interaction space.
import { Mosyn, MosynManager } from 'mosyn';
export function Dashboard() { return ( <MosynManager> <Mosyn tiles={tiles} /> </MosynManager> );}Use one provider for the root grid and all nested grids it contains. Its appearance props apply consistently to root and nested grids, including drag previews.
MosynManagerProvider remains available as a deprecated compatibility alias.
| Prop | Type | Default | Description |
|---|---|---|---|
dark |
boolean |
false |
Uses Mosyn’s built-in dark palette. |
dots |
boolean |
false |
Enables the optional dot pattern on every grid. |
theme |
MosynTheme |
— | Overrides semantic colours across every grid and drag overlay. |
<MosynManager dark dots theme={{ gridBackground: '#101826', tileBackground: '#172235', tileSelectedBorder: '#a78bfa', }}> <Mosyn tiles={tiles} /></MosynManager>Mosyn renders one grid.
<Mosyn tiles={tiles} />| Prop | Type | Required | Description |
|---|---|---|---|
tiles |
Tile[] |
Yes | The tiles used to seed the grid. Keep the array reference stable between unrelated renders. |
DragCancel |
string[] |
No | CSS selectors for elements that should not start a drag. |
disabled |
boolean |
No | Disables selection, dragging, resizing, and trimming for this grid. |
container |
Tile |
No | Identifies this grid as the nested grid inside a container tile. |
dark |
boolean |
No | Overrides the manager’s dark-mode setting for this grid. |
dots |
boolean |
No | Overrides the manager’s dot-pattern setting for this grid. |
theme |
MosynTheme |
No | Merges over the manager theme for this grid. |
Override a nested grid
Section titled “Override a nested grid”Use grid props when a workspace needs a different appearance from its parent.
renderer: (tile) => ( <Mosyn tiles={tile.children ?? []} container={tile} dark={false} dots theme={{ gridBackground: '#fff3ed', tileBackground: '#fffdfb', tileSelectedBorder: '#d65f4b', }} />)Basic example
Section titled “Basic example”import { Mosyn, MosynManager } from 'mosyn';import type { Tile } from 'mosyn';
const tiles: Tile[] = [ { id: 'overview', x: 1, y: 1, w: 58, h: 18, renderer: <Overview /> }, { id: 'activity', x: 61, y: 1, w: 58, h: 18, renderer: <Activity /> },];
export function Dashboard() { return ( <MosynManager> <Mosyn tiles={tiles} DragCancel={['button', 'a', '.no-drag']} /> </MosynManager> );}Mosyn needs a host with a resolved height. See Getting started for the required layout CSS.
MosynManagerContext
Section titled “MosynManagerContext”MosynManagerContext is also exported for advanced integrations. Prefer useMosynManager for application code; it validates provider usage and gives access to selection state.
MosynGridProps and TileProps
Section titled “MosynGridProps and TileProps”MosynGridProps is the public TypeScript type for <Mosyn /> props.
TileProps describes the internal element Mosyn renders for each tile. It is exported for type compatibility, but applications normally define tiles through the Tile type rather than rendering a TileProps component themselves.