Build dashboard layouts
Mosyn starts from the tile array you provide. A good starting layout gives people a useful dashboard immediately, then leaves room for them to make it their own.
Start with stable tiles
Section titled “Start with stable tiles”Keep the initial tile array outside the component when it is static. If it is derived from data, memoize it before passing it to <Mosyn />.
import type { Tile } from 'mosyn';
export const dashboardTiles: Tile[] = [ { id: 'summary', x: 1, y: 1, w: 38, h: 18, renderer: <Summary /> }, { id: 'activity', x: 41, y: 1, w: 38, h: 18, renderer: <Activity /> }, { id: 'alerts', x: 81, y: 1, w: 38, h: 18, renderer: <Alerts /> },];Use IDs that represent the dashboard feature, not its current position. summary stays meaningful if a person moves it to another part of the dashboard.
Work in grid units
Section titled “Work in grid units”The root grid has 120 columns. x and y set a tile’s top-left position; w and h set how many grid units it occupies.
| Field | Use it for |
|---|---|
x |
Horizontal placement |
y |
Vertical placement |
w |
Tile width |
h |
Tile height |
Place tiles from 1, not 0. Leave one unit between adjacent tiles in your initial layout so the dashboard has a clear gutter.
export const dashboardTiles: Tile[] = [ { id: 'summary', x: 1, y: 1, w: 58, h: 18, renderer: <Summary /> }, { id: 'activity', x: 61, y: 1, w: 58, h: 18, renderer: <Activity /> },];Constrain important tiles
Section titled “Constrain important tiles”Use minimum and maximum dimensions when a tile needs to remain useful at a particular size. A table might need a minimum width; a compact status card may need a maximum height.
export const dashboardTiles: Tile[] = [ { id: 'orders', x: 1, y: 1, w: 78, h: 24, minW: 38, minH: 18, renderer: <OrdersTable />, },];Use constraints sparingly. They are most valuable when content genuinely stops being usable below a certain size.
Let tile content fill its space
Section titled “Let tile content fill its space”Mosyn sizes the tile. Your renderer should make its own root element fill that space.
export function Summary() { return <section className="dashboard-panel">Summary</section>;}.dashboard-panel { width: 100%; height: 100%; overflow: hidden;}This keeps charts, tables, and panels aligned as a tile is resized.
Use a clear visual hierarchy
Section titled “Use a clear visual hierarchy”Give the first row to the dashboard’s primary information, then group related supporting work below it. Large tiles should communicate importance, not simply hold more content.
For dashboards with several kinds of work, use a container tile to create a distinct workspace. See Nested grids when one part of a dashboard needs its own local arrangement.