Skip to content
Forms, switch product

gui.layouts reference

Every layout shortcut takes a children array. Most also take a props object as the second argument. gui.layouts.tabs and gui.layouts.accordion are exceptions — they take a sections array instead, where each section has its own label and children.

Most layouts:

gui.layouts.<shortcut>(children: ValidGuiShortcut[], props?: Props, tags?: string[]): GuiLayoutsShortcut;

Tabs / accordion:

gui.layouts.tabs(sections: TabSection[], props?: Props, tags?: string[]): GuiTabsShortcut;
gui.layouts.accordion(sections: AccordionSection[], props?: Props, tags?: string[]): GuiAccordionShortcut;

A fully-populated grid example:

gui.layouts.grid(
[
// children — any array of gui.* shortcuts
gui.inputs.textInput('first', { label: 'First name' }),
gui.inputs.textInput('last', { label: 'Last name' }),
],
{
// props — the layout's typed props + DX fields
direction: 'row',
gap: 'sm',
size: 1,
states: {
// per-state overrides
compactMode: { direction: 'column' },
},
include: { in: ['hasName'] },
},
['identity-row'], // tags — addressable groups for selectors
);

A tabs example with two sections:

gui.layouts.tabs([
{
label: 'Delivery address',
children: [
gui.inputs.textInput('delivery.street', { label: 'Street' }),
gui.inputs.textInput('delivery.city', { label: 'City' }),
],
},
{
label: 'Invoice address',
children: [
gui.inputs.textInput('invoice.street', { label: 'Street' }),
gui.inputs.textInput('invoice.city', { label: 'City' }),
],
},
]);
ShortcutRendersReference
gui.layouts.grida grid: a stack by defaultGrid
gui.layouts.horizontalGridgrid with direction: 'row'Grid
gui.layouts.verticalGridgrid with direction: 'column'Grid
gui.layouts.tabstabsTabs
gui.layouts.accordionaccordionAccordion
gui.layouts.customyour custom layoutCustom Widgets

These still work and render a grid. v3.0.0 removes them, so move them to the grid shortcuts:

ShortcutUse insteadReference
gui.layouts.flexgui.layouts.gridFlex
gui.layouts.horizontalFlexgui.layouts.horizontalGridFlex
gui.layouts.verticalFlexgui.layouts.verticalGridFlex

Use grid for stacks, rows and columns alike. In a row or in columns, it lines up the labels, controls and errors of the fields next to each other.

  • Tabs and Accordion — both take a sections array as the first arg, where each section has its own children.