Skip to content
D
Documentation

Dashboard Kit — interfaces

reference
6 min readUpdated

Interfaces

Import these from @grafloria/element.

Interfaces

BarWidgetData

kind: 'bar' — categorical columns.

ts
interface BarWidgetData

Properties

NameTypeDefaultDescription
bars?Array<{ label?: string; value?: number }>

CellRect

One tile in integer board cells — the shape GridPackEngine speaks.

ts
interface CellRect

Properties

NameTypeDefaultDescription
xnumber
ynumber
wnumber
hnumber

DashboardGridApi

The slice of a DiagramInstance the binder needs (structural, test-friendly).

ts
interface DashboardGridApi

Properties

NameTypeDefaultDescription
containerHTMLElement
viewport?{ clientToWorld( clientX: number, clientY: number, rect: { left: number; top: number; width: nu...

Members

  • getModel(): DiagramModel
  • getEngine(): { commandManager: { execute(cmd: Command): Promise<unknown> | unknown } }
  • render(): void
  • renderNow(): void

DashboardGridGeometry

ts
interface DashboardGridGeometry

Properties

NameTypeDefaultDescription
columnsnumberColumn count of the board (default 12).
gapnumberGap between cells, px.
paddingnumberPadding between the board frame and the outermost cells, px.
sizing'fit' | 'grow'
baseRowHeightnumberRow height in 'grow' mode, px.
minRowHeightnumberFloor for the derived 'fit' row height, px.
designHeightnumberThe board's design height — 'fit' keeps it, 'grow' never shrinks below it.
rtl?booleanRIGHT-TO-LEFT boards. The MODEL is direction-agnostic — cell x=0 is always "the first column" and every rule in GridPackEngine (push, swap, gravity, the anti-jitter gate) is written in cells, so none of it changes. ONLY this module's pixel mapping mirrors: x=0 renders at the board's RIGHT edge and columns run leftwards. A layout saved in one direction therefore renders mirrored in the other with

DashboardSpec

What dashboard() returns — a render spec plus the runtime handle.

ts
interface DashboardSpec

Properties

NameTypeDefaultDescription
nodesArray<Record<string, unknown>>
edgesArray<Record<string, unknown>>
renderCustomNode(node: unknown, host: HTMLElement)
finalize(api: unknown)
handleDashboardHandleLive handle, populated by finalize().
renderOptions?{ minZoom?: number; maxZoom?: number }Instance options the spec asks render() to apply — a fluid board pins the zoom range to 1 so the layout can never become a scaled picture.

DashboardViewSpec

One board. Multiple views are the tab pattern: only one is on-camera.

ts
interface DashboardViewSpec

Properties

NameTypeDefaultDescription
idstring
name?string
widgetsDashboardWidgetSpec[]
columns?numberPer-view overrides of the dashboard-level geometry.
width?number
height?number
layout?'grid' | 'split'Per-view layout (default: the dashboard-level layout). toJSON() writes it per view.
tree?SplitNode | nullSPLIT layout only: the authored splitter tree (see layout). Omit it and the tree is derived from the widgets' cells, so a grid-authored view keeps its proportions when it opens as a split board. toJSON() writes it back.

DonutWidgetData

kind: 'donut' — parts of a whole, with a legend and a centre figure.

ts
interface DonutWidgetData

Properties

NameTypeDefaultDescription
slices?Array<{ label?: string; value?: number; color?: string }>
centerLabel?stringCentre figure (default: the compacted total).
centerCaption?stringCaption under the centre figure (default 'total').

DragGripOptions

A painted grip: the only drag zone, placed along the card's top edge.

ts
interface DragGripOptions

Properties

NameTypeDefaultDescription
griptrue
position?'left' | 'center' | 'right'Where along the top edge. Default 'left'.
placement?'inside' | 'outside'In the header band, or a tab above the card. Default 'inside'.

FunnelWidgetData

kind: 'funnel' — ordered stages, each bar scaled against the first.

ts
interface FunnelWidgetData

Properties

NameTypeDefaultDescription
stages?Array<{ label?: string; value?: number }>

KpiWidgetData

kind: 'kpi' — one headline number, an optional change, an optional trend.

ts
interface KpiWidgetData

Properties

NameTypeDefaultDescription
label?stringSmall caption above the number (falls back to widget.title).
value?string | numberThe headline — pre-formatted by you, so units/currency stay yours.
delta?numberSigned percentage change. Positive paints up/green, negative down/red.
deltaLabel?stringCaption after the delta (default 'vs previous').
spark?number[]Sparkline values, oldest → newest. Fewer than 2 points draws nothing.

LineSeries

One named line of a kind: 'line' chart.

ts
interface LineSeries

Properties

NameTypeDefaultDescription
name?string
valuesnumber[]

LineWidgetData

kind: 'line' — one or many series over a shared x axis (area + line).

ts
interface LineWidgetData

Properties

NameTypeDefaultDescription
series?number[] | LineSeries[]A bare number[] is the single-series shorthand.
labels?string[]X-axis tick labels, positionally matched to the values.

SectionCaptionAction

SECTION CAPTIONS — the header a section (container widget) may carry, painted by the kit on the slab overlay it already owns.

Three things only the kit can do for a section header, and this module is where they are decided: RESERVE the pixels (captionReserve — the nested board's frame starts below the band, so no child may take it), PAINT it (paintCaptionBand — one DOM shape, one set of CSS variables, one theme), and ROUTE its presses (captionPassThrough — a button or an input in the band is content, everything else is the band, which selects the section). Persistence is the container's business: the caption rides on the group's containerWidget metadata beside layout and sizing, and toJSON() writes it back.

Plan and defaults: documentation/api-architecture/section-caption-plan.html.

ts
interface SectionCaptionAction

Properties

NameTypeDefaultDescription
idstring
labelstringAccessible name; painted as the glyph when there is no icon.
icon?stringA glyph (emoji or short text).
title?stringTooltip; default: the label.
disabled?boolean

SectionCaptionFont

ts
interface SectionCaptionFont

Properties

NameTypeDefaultDescription
size?number
weight?number | string
family?string
color?string
transform?'none' | 'uppercase'

TableWidgetData

kind: 'table' — plain rows. Numbers right-align on their own.

ts
interface TableWidgetData

Properties

NameTypeDefaultDescription
columns?string[]
rows?Array<Array<string | number>>

TabPage

ts
interface TabPage

Properties

NameTypeDefaultDescription
idstring
labelstring

TileDelta

ts
interface TileDelta

Properties

NameTypeDefaultDescription
idstring
locked?boolean
isGroup?booleanGroup members (layout slabs) get cells-only commands — never Move/Resize.
cellBeforeCellRect
cellAfterCellRect
posBefore{ x: number; y: number }
posAfter{ x: number; y: number }
sizeBefore{ width: number; height: number; depth?: number }
sizeAfter{ width: number; height: number; depth?: number }

WorldRect

A world-space rectangle (the group frame, or a projected tile).

ts
interface WorldRect

Properties

NameTypeDefaultDescription
xnumber
ynumber
widthnumber
heightnumber

Was this page helpful?