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.
Signature
Section titled “Signature”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' }), ], },]);Shortcuts
Section titled “Shortcuts”| Shortcut | Renders | Reference |
|---|---|---|
gui.layouts.grid | a grid: a stack by default | Grid |
gui.layouts.horizontalGrid | grid with direction: 'row' | Grid |
gui.layouts.verticalGrid | grid with direction: 'column' | Grid |
gui.layouts.tabs | tabs | Tabs |
gui.layouts.accordion | accordion | Accordion |
gui.layouts.custom | your custom layout | Custom Widgets |
Deprecated shortcuts
Section titled “Deprecated shortcuts”These still work and render a grid. v3.0.0 removes them, so move them to the grid shortcuts:
| Shortcut | Use instead | Reference |
|---|---|---|
gui.layouts.flex | gui.layouts.grid | Flex |
gui.layouts.horizontalFlex | gui.layouts.horizontalGrid | Flex |
gui.layouts.verticalFlex | gui.layouts.verticalGrid | Flex |
Layout recommendation
Section titled “Layout recommendation”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.