Installation
GolemUI is a blazing fast JavaScript library for building dynamic forms from JSON files or other data sources. It provides a free set of UI widgets with support for React, Angular, and Lit.
This guide walks you from an empty directory to a rendered form in five steps.
-
Scaffold a new project
Section titled “Scaffold a new project”Use Vite (or your favourite scaffolder) to create a fresh project for your framework. For example, with Vite:
Terminal window npm create vite@latest my-form -- --template react-tscd my-form && npm installTerminal window npx @angular/cli new my-formcd my-formTerminal window npm create vite@latest my-form -- --template lit-tscd my-form && npm install -
Install GolemUI and the Golem Widgets
Section titled “Install GolemUI and the Golem Widgets”Pick the adapter package for the framework you’re using.
Terminal window npm i @golemui/core @golemui/react @golemui/gui-react --saveTerminal window npm i @golemui/core @golemui/angular @golemui/gui-angular --saveTerminal window npm i @golemui/core @golemui/lit @golemui/gui-lit --save -
Import the Golem Widgets styles
Section titled “Import the Golem Widgets styles”Load the CSS file directly in your HTML or import it in your Sass/CSS file.
@import '@golemui/core/styles/index.css'; -
Define a form and render it
Section titled “Define a form and render it”The easiest way to define a form is the Programmatic API, an array of
gui.*shortcuts. The same form can also be defined as JSON if you prefer.import { gui } from '@golemui/gui-shared';import * as React from '@golemui/gui-react';const formDef = [gui.inputs.textInput('username')];const formData = { username: 'golemui' };const formConfig = { widgetLoaders: React.widgetLoaders };export function FormPage() {return (<div><React.FormComponentformDef={formDef}data={formData}formConfig={formConfig}/></div>);}import { Component } from '@angular/core';import { CommonModule } from '@angular/common';import { gui } from '@golemui/gui-shared';import * as Angular from '@golemui/gui-angular';@Component({imports: [CommonModule, Angular.FormComponent],selector: 'app-dynamic-form',template: `<gui-form[formDef]="formDef"[data]="formData"[formConfig]="formConfig"></gui-form>`,})export class AppFormPage {protected formDef = [gui.inputs.textInput('username')];protected formData = { username: 'golemui' };protected formConfig = { widgetLoaders: Angular.widgetLoaders };}import { LitElement, html } from 'lit';import { customElement } from 'lit/decorators.js';import { gui } from '@golemui/gui-shared';import * as Lit from '@golemui/gui-lit';@customElement('lit-form')export class FormElement extends LitElement {formDef = [gui.inputs.textInput('username')];formData = { username: 'golemui' };formConfig = { widgetLoaders: Lit.widgetLoaders };override createRenderRoot() {return this;}render() {return html`<gui-form.formDef=${this.formDef}.data=${this.formData}.formConfig=${this.formConfig}></gui-form>`;}}Create a JSON file with your form definition and pass it to the form component:
{"form": [{ "kind": "input", "type": "textinput", "path": "username" }]}Then load and render it in your framework. See the Integration section for framework-specific setup.
-
That’s it
Section titled “That’s it”Run your dev server and you’ll see your form rendered in the browser.
Next steps
Section titled “Next steps”Ready for something more substantial? Walk through the Rent a Car form tutorial, where you’ll build a real, multi-field form with conditional logic, custom item renderers, async data loading, and form submission.
For framework-specific configuration (React, Angular, Lit), see the Integration section.