Skip to content

Form Definition API

The Form Definition API is the Programmatic surface for declaring forms in GolemUI. You import a single gui namespace from @golemui/gui-shared and compose your form as an array of typed shortcut calls.

import { gui } from '@golemui/gui-shared';
const formDef = [
gui.inputs.textInput('name', { label: 'Name' }),
gui.inputs.dropdown('country', { items: ['US', 'CA'] }),
gui.actions.submitButton({ label: 'Submit' }),
];

The same form can be written in JSON; both feed into the same <gui-form> component. The Programmatic API gives you compile-time safety, IDE autocomplete, and a much more compact syntax.

The API is grouped by widget kind:

GroupWhat it produces
gui.inputsInput widgets — text input, number, select, dropdown, calendar, repeater, etc.
gui.actionsButtons and other action widgets.
gui.displaysDisplay widgets — alert, markdown text, custom render functions.
gui.layoutsContainers — flex, grid, tabs, accordion.
gui.selectorsBehavior layer — decorate widgets by type, tag, or uid.

Each input/action/display/layout group also exposes a .custom(...) method for plugging in your own widgets.