Skip to content

Nested workspace

This example builds on the nested-grid pattern used in the Mosyn demo. The workspace is one tile in the root dashboard and a grid in its own right.

workspace.tsx
import type { Tile } from 'mosyn';
const workspaceTiles: Tile[] = [
{ id: 'workspace-notes', parentId: 'workspace', x: 1, y: 1, w: 24, h: 14, renderer: <Notes /> },
{ id: 'workspace-tasks', parentId: 'workspace', x: 27, y: 1, w: 24, h: 14, renderer: <Tasks /> },
{ id: 'workspace-calendar', parentId: 'workspace', x: 1, y: 17, w: 24, h: 14, renderer: <Calendar /> },
];

Render the workspace inside a container tile

Section titled “Render the workspace inside a container tile”
workspace.tsx
import { Mosyn } from 'mosyn';
export const workspace: Tile = {
id: 'workspace',
x: 41,
y: 21,
w: 78,
h: 40,
isContainer: true,
children: workspaceTiles,
renderer: (tile) => <Mosyn tiles={tile.children ?? []} container={tile} />,
};

The nested <Mosyn /> is rendered by your application, while the shared provider continues to coordinate the full dashboard.

tiles.tsx
export const dashboardTiles: Tile[] = [
{ id: 'overview', x: 1, y: 1, w: 38, h: 18, renderer: <Overview /> },
{ id: 'activity', x: 41, y: 1, w: 38, h: 18, renderer: <Activity /> },
workspace,
];

Use unique ids across the root dashboard and every workspace. This keeps tile identity stable when the overall dashboard changes.