Skip to content

PanelNodes

The components from which a panel or an outline type is built. Each one is a function that returns a node, which is a plain description of the component that the app draws. A property whose value is undefined is left out. Because every component is a typed function, a misspelled property is a type error.

ctx.ui.panel({
id: 'today',
title: 'Today',
render: () => ctx.ui.stack({ axis: 'vertical', gap: 8 }, [
ctx.ui.text({ text: 'Good morning', style: 'title' }),
ctx.ui.button({ title: 'Start', action: () => ctx.dispatch(start.intent({})) }),
]),
});
board(props, children): PanelNode;

Displays a board: a row of columns that hold cards, which the person can drag from one column to another.

Parameter Type Description
props { add?: PanelHandler<{ }>; addTitle?: string; } add is invoked when the person presses the button that creates a column, and addTitle is the text of that button.
props.add? PanelHandler<{ }> -
props.addTitle? string -
children Children the columns of the board, made with column

PanelNode

the node


button(props): PanelNode;

Displays a button. Pressing it invokes action, or runs the request given as intent. The optional role, which is either destructive or cancel, adjusts the appearance of the button.

Parameter Type Description
props Pressable & object title is the text of the button, role adjusts its appearance, and action or intent is what happens when it is pressed.

PanelNode

the node


card(props): PanelNode;

Displays one card of a column. Most properties are handlers: tap is invoked with { card } when the card is pressed, open with { card } when its title is double-clicked, edit with { card, title } when the person has typed a new title, and drag with { card, column, before } when the card is dragged and dropped on a column or on another card. While editing is true, the title is displayed as an editable field.

Parameter Type Description
props { done?: boolean; drag?: PanelHandler<{ before?: string; card: string; column?: string; }>; edit?: PanelHandler<{ card: string; title: string; }>; editing?: boolean; id: string; open?: PanelHandler<{ card: string; }>; subtitle?: string; tap?: PanelHandler<{ card: string; }>; title: string; } id identifies the card, title is its text, subtitle is an optional second line, done marks the card as completed, and tap, open, edit, drag and editing are described above.
props.done? boolean -
props.drag? PanelHandler<{ before?: string; card: string; column?: string; }> -
props.edit? PanelHandler<{ card: string; title: string; }> -
props.editing? boolean -
props.id string -
props.open? PanelHandler<{ card: string; }> -
props.subtitle? string -
props.tap? PanelHandler<{ card: string; }> -
props.title string -

PanelNode

the node


chart(props): PanelNode;

Displays a chart, drawn as bars or as lines depending on kind. Each entry of series supplies a list of numbers and, optionally, a label.

Parameter Type Description
props { kind?: "bar" | "line"; label?: string; series: readonly object[]; } kind is bar or line, label is an optional title, and series is the list of data series.
props.kind? "bar" | "line" -
props.label? string -
props.series readonly object[] -

PanelNode

the node


column(props, children): PanelNode;

Displays one column of a board, with a header that shows its title and, optionally, the number of cards. Most properties are handlers: drop is invoked with { card, column } when a card is dropped on the column, add with { column } when the person presses the + button, open with { column } when the title is double-clicked, and edit with { column, title } when the person has typed a new title. While editing is true, the title is displayed as an editable field.

Parameter Type Description
props { add?: PanelHandler<{ column: string; }>; count?: number; drop?: PanelHandler<{ card: string; column: string; }>; edit?: PanelHandler<{ column: string; title: string; }>; editing?: boolean; id: string; open?: PanelHandler<{ column: string; }>; title: string; } id identifies the column, title and count appear in its header, and drop, add, open, edit and editing are described above.
props.add? PanelHandler<{ column: string; }> -
props.count? number -
props.drop? PanelHandler<{ card: string; column: string; }> -
props.edit? PanelHandler<{ column: string; title: string; }> -
props.editing? boolean -
props.id string -
props.open? PanelHandler<{ column: string; }> -
props.title string -
children Children the cards of the column, made with card

PanelNode

the node


divider(props?): PanelNode;

Draws a thin line between the components that surround it.

Parameter Type Description
props? Record<never, never> an empty object, because a divider has no properties.

PanelNode

the node


field(props): PanelNode;

Displays an editable field with a label. The optional kind restricts the content to text or to numbers, and action is invoked with { value } each time the content changes.

Parameter Type Description
props { action?: PanelHandler<{ value: string | number; }>; kind?: "number" | "text"; label: string; value?: string | number; } label is the text of the field, value is its current content, kind is text or number, and action receives { value } when the content changes.
props.action? PanelHandler<{ value: string | number; }> -
props.kind? "number" | "text" -
props.label string -
props.value? string | number -

PanelNode

the node


icon(props): PanelNode;

Displays an icon chosen by name.

Parameter Type Description
props { name: string; } name is the name of the icon.
props.name string -

PanelNode

the node


list(props, children): PanelNode;

Displays its children one below the other. The children are normally row components.

Parameter Type Description
props Record<never, never> an empty object, because a list has no properties.
children Children the components of the list

PanelNode

the node


picker(props): PanelNode;

Lets the person choose one option from a list. The app invokes action with { value } when the selection changes.

Parameter Type Description
props { action?: PanelHandler<{ value: string; }>; label: string; options: readonly (readonly [string, string])[]; value: string; } label is the text of the control, value is the current selection, options is an array of [value, label] pairs, and action receives { value } when the selection changes.
props.action? PanelHandler<{ value: string; }> -
props.label string -
props.options readonly (readonly [string, string])[] -
props.value string -

PanelNode

the node


progress(props): PanelNode;

Displays a progress bar. The value is the completed percentage, between 0 and 100. The optional label is the text that assistive technologies announce.

Parameter Type Description
props { label?: string; value: number; } value is the completed percentage, and label is the text for assistive technologies.
props.label? string -
props.value number -

PanelNode

the node


row(props): PanelNode;

Displays one entry of a list: a title, with an optional subtitle, and an optional accessory text at the end of the line. A row can be pressed, in which case the app invokes action or runs the request given as intent.

Parameter Type Description
props Pressable & object title is the main text, subtitle is a second line, accessory is a short text at the end of the line, and action or intent is what happens when the row is pressed.

PanelNode

the node


spacer(props?): PanelNode;

Leaves an empty space between components.

Parameter Type Description
props? Record<never, never> an empty object, because a spacer has no properties.

PanelNode

the node


stack(props, children): PanelNode;

Arranges its children in a row or in a column, depending on axis, with a fixed space between them.

Parameter Type Description
props { axis?: "horizontal" | "vertical"; gap?: number; } axis selects the direction, horizontal or vertical, and gap sets the space between two children, in pixels.
props.axis? "horizontal" | "vertical" -
props.gap? number -
children Children the components to arrange

PanelNode

the node


text(props): PanelNode;

Displays a piece of text. The optional style selects its appearance: title renders a larger and bolder text, and caption renders a smaller and muted one. Without a style, the text has the ordinary appearance.

Parameter Type Description
props { style?: string; text: string; } text is the text to display, and style is its appearance.
props.style? string -
props.text string -

PanelNode

the node


toggle(props): PanelNode;

Displays a switch with a label. The app invokes action with { value } each time the person flips the switch.

Parameter Type Description
props { action?: PanelHandler<{ value: boolean; }>; label: string; value?: boolean; } label is the text next to the switch, value is its current state, and action receives { value } when the person changes it.
props.action? PanelHandler<{ value: boolean; }> -
props.label string -
props.value? boolean -

PanelNode

the node