Skip to content

Angular

Terminal window
npm i @golemui/core @golemui/gui-shared @golemui/angular @golemui/gui-angular --save

Import the core styles in your styles.scss or angular.json:

@import '@golemui/gui-components/index.css';

<gui-form> only needs a formDef. The framework’s built-in widget set is loaded automatically, and an empty form renders fine without initial data.

import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { gui } from '@golemui/gui-shared';
import { FormComponent } from '@golemui/gui-angular';
@Component({
imports: [CommonModule, FormComponent],
selector: 'app-my-form',
template: `<gui-form [config]="config"></gui-form>`,
})
export class MyFormComponent {
protected config = {
formDef: [gui.inputs.textInput('username', { label: 'Username' })],
};
}

Reach for these only when you need them. data prefills the form; customWidgetLoaders is for widgets you’ve built yourself (the framework’s built-ins are merged automatically). Every other config property in the table below follows the same rule — opt in as the form grows.

import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { gui } from '@golemui/gui-shared';
import { FormComponent } from '@golemui/gui-angular';
import { myCustomWidgets } from './my-custom-widgets';
@Component({
imports: [CommonModule, FormComponent],
selector: 'app-my-form',
template: `<gui-form [config]="config"></gui-form>`,
})
export class MyFormComponent {
protected config = {
formDef: [gui.inputs.textInput('username', { label: 'Username' })],
data: { username: 'octocat' }, // optional — initial form data
customWidgetLoaders: myCustomWidgets, // optional — only when the form references widgets you've built yourself
};
}

All initialization properties are bundled in the required [config] input (GuiFormInitConfig):

config propertyTypeDescription
formDef (required)FormInputProgrammatic gui.* array or parsed JSON form definition.
formSelectorsGslSelectorsInputGSL selector decorators. Programmatic-only.
formConfigDxFormConfigDX engine wiring (loaders, item renderers, dependencies, validateOn, …). Programmatic-only.
dataRecord<string, any>Initial form data.
metaRecord<string, any>Out-of-band metadata you want to thread through events and state.
customWidgetLoadersWidgetLoaders<Type<WithWidget>>Custom widget map; merged with the default Angular widget set.
itemRenderersRecord<string, AngularItemRenderer<any>>Custom item-renderer map (for dropdown, list, etc.).
customValidatorsCustomValidatorSchemasCustom validator schemas referenced by validator: { type: 'custom', ... }.
middlewaresMiddleware<State, Action>[]Store middlewares (logging, persistence, devtools).
validateOnValidateOnWhen validation runs: 'eager' (default), 'change', 'blur', 'submit', or an array.
dependenciesDependenciesExternal helpers (e.g. a markdown parser).
localizationI18nTranslatorTranslator implementing the I18nTranslator interface.

Direct inputs (outside config):

InputTypeDescription
autocompletestringSets the underlying <form> element’s autocomplete attribute.

The component also exposes two outputs:

OutputTypeDescription
(formEvent)FormEventEmitted when a widget fires a wired event.
(formHealth)FormHealthEmitted when the form’s validation status changes.

See Configuration for details on each input, plus the Programmatic-only vs JSON-form notes.

Build your own widgets by implementing WithWidget (from @golemui/core) and injecting one of the framework’s *WidgetAdapter services (InputWidgetAdapter, LayoutWidgetAdapter, DisplayWidgetAdapter, ActionWidgetAdapter) in your constructor. The adapter handles init / destroy and exposes a reactive templateData signal. See Extending GolemUI / Widgets for the full walkthrough.