1. Introduction
A Domain-Specific Language (DSL) is a mini-language created for a specific domain. In our case, the domain is “UI screen design”. Instead of writing:
HTML
TypeScript
Angular components
Services
FormGroups
Developers write
{
"title": "Create Employee",
"type": "form",
"fields": [
{ "label": "First Name", "type": "text", "model": "firstName", "required": true },
{ "label": "Age", "type": "number", "model": "age" }
],
"actions": [
{ "label": "Save", "action": "saveEmployee" }
]
}
Angular interprets this JSON and constructs a fully working screen.
This approach has become common in low-code platforms and internal tooling frameworks. With Angular 17’s standalone APIs and improved dynamic component capabilities, building DSL-driven screens is easier than ever.
2. Why a UI DSL Is Needed
2.1 Repeated UI Patterns
Most enterprise screens follow similar structures: forms, tables, sections, tabs, filters, detail panes. A DSL allows defining these structures once and reusing them everywhere.
2.2 Faster Development
New screens can be created in minutes just by writing JSON configuration. No new Angular components are needed.
2.3 Centralised Governance
Validation, accessibility rules, grid styling, date formats, and error messages are all governed centrally. Changes apply to all screens instantly.
2.4 Business Users Can Contribute
A non-developer can create screens without Angular expertise, as long as they follow the JSON schema.
2.5 Easier Maintenance
Instead of tracking many components, you track one renderer engine and many JSON configurations.
3. Architecture Overview
A UI DSL system for Angular has four major layers:
1. DSL Definition Layer
Defines the JSON schema: field types, layout instructions, actions, validation structure, and events.
2. Parser and Validator
Reads the JSON, validates it, and converts it into an internal meta-model.
3. Angular Renderer Engine
Creates UI dynamically using Angular’s component factories, templates, and dynamic bindings.
4. Data and Event Engine
Handles
form binding
event triggers
API communication
conditional visibility
computed expressions
This architecture separates “what to build” (JSON) from “how to build it” (Angular engine).
4. Workflow Diagram
(Plain text format suitable for articles)
+----------------------+
| JSON UI Schema |
+----------+-----------+
|
v
+---------------+---------------+
| DSL Parser & Validator |
+---------------+---------------+
|
v
+---------------+---------------+
| Meta-Model Generator |
+---------------+---------------+
|
v
+---------------+---------------+
| Angular Renderer Engine |
+---------------+---------------+
|
v
+------------+-------------+
| Dynamic UI Component |
+--------------------------+
5. Flowchart
(Explains runtime behaviour)
Start
|
v
Load JSON configuration
|
v
Validate configuration?
/ \
Yes No
| |
v v
Generate meta-model Throw error
|
v
Render components dynamically
|
v
Bind FormGroups and events
|
v
User interacts with UI
|
v
Trigger events → call API or logic
|
v
End
6. Designing the JSON DSL
Designing the DSL is the most important step. It determines the flexibility of your system.
Below is a practical JSON DSL structure.
6.1 Screen-Level Structure
{
"title": "Employee Form",
"type": "form",
"layout": "two-column",
"fields": [...],
"actions": [...],
"api": {
"load": "/api/employee/:id",
"submit": "/api/employee"
}
}
6.2 Field Definition
{
"label": "Email Address",
"type": "email",
"model": "email",
"required": true,
"placeholder": "Enter email",
"validationMessage": "Valid email required"
}
6.3 Supported Field Types
Keep it standardised:
text
number
email
dropdown
checkbox
radio
date
textarea
table
section
tab
6.4 Action Definition
{
"label": "Submit",
"type": "primary",
"action": "submitForm",
"confirm": true
}

Join the conversation! Your thoughts help the community grow.