Tile
Tile is the layout and rendering model for one dashboard item.
import type { Tile } from 'mosyn';
const revenue: Tile = { id: 'revenue', x: 1, y: 1, w: 58, h: 18, renderer: <RevenueChart />,};Required fields
Section titled “Required fields”| Field | Type | Description |
|---|---|---|
id |
string |
Stable, unique tile identity. |
x |
number |
Horizontal grid position. |
y |
number |
Vertical grid position. |
w |
number |
Tile width in grid units. |
h |
number |
Tile height in grid units. |
The root grid uses 120 columns. Positions start at 1; use one unit of separation between tiles in your initial layout.
Content fields
Section titled “Content fields”| Field | Type | Description |
|---|---|---|
renderer |
React.JSX.Element or (tile) => React.JSX.Element |
The UI displayed inside the tile. |
data |
T |
Application data associated with the tile. |
style |
CSSProperties |
Inline styles applied to the tile outer element. |
header |
React.JSX.Element |
Optional tile header content. |
footer |
React.JSX.Element |
Optional tile footer content. |
Use a renderer function when the UI should read the current tile.
const revenue: Tile<{ total: number }> = { id: 'revenue', x: 1, y: 1, w: 58, h: 18, data: { total: 48250 }, renderer: (tile) => <RevenueChart total={tile.data?.total ?? 0} />,};Size constraints
Section titled “Size constraints”| Field | Type | Description |
|---|---|---|
minW |
number |
Minimum width during resize. |
maxW |
number |
Maximum width during resize. |
minH |
number |
Minimum height during resize. |
maxH |
number |
Maximum height during resize. |
const orders: Tile = { id: 'orders', x: 1, y: 1, w: 78, h: 24, minW: 38, minH: 18, renderer: <OrdersTable />,};Container fields
Section titled “Container fields”| Field | Type | Description |
|---|---|---|
isContainer |
boolean |
Marks the tile as the host for a nested grid. |
children |
Tile[] |
Child tile collection for a nested grid. |
parentId |
string |
Id of the container grid the tile belongs to. |
See Nested grids for the full container pattern.