# Declare: A UI Language Built for Humans and AI

> Published 2026-11-24 · https://www.promptzone.com/kofi_saleh/declare-a-ui-language-built-for-humans-and-ai-3732

David Temkin’s **Declare** language surfaced on [Hacker News](https://davidtemkin.github.io/declarelang/) this week, proposing a unified syntax for describing user interfaces that both humans and AI models can read and write. The project, discussed in a thread garnering **32 points and 15 comments**, targets a core friction point in AI-assisted development: translating natural language into functional UI code.

> **Language:** Declare | **Status:** Specification & Early Prototype | **Paradigm:** Declarative, JSON-like | **Primary Use:** UI Specification

## What Declare Is
Declare is a **declarative domain-specific language (DSL)** for defining user interfaces. It is not a rendering engine or a framework, but a specification language intended to sit between a designer’s (or AI’s) intent and final implementation code like HTML, SwiftUI, or Jetpack Compose.

The core premise is interoperability. A single Declare document could be compiled to different platform-specific UI toolkits, or serve as a reliable, structured format for AI agents to output when asked to generate a interface.


![Declare: A UI Language Built for Humans and AI](https://promptzone-community.s3.amazonaws.com/uploads/articles/cblixgqg4et7pt3v4m4u.jpeg)

## How It Works: Syntax and Structure
Declare uses a **JSON-like syntax** with familiar UI primitives. Elements are defined with a type, properties (`props`), and children. Its design emphasizes simplicity and predictability for LLM generation.

A basic button in Declare looks like this:
```json
{
  "type": "Button",
  "props": { "label": "Submit", "enabled": true },
  "children": []
}
```
A more complex layout, like a column with text and a button, nests these objects within a `Container` element's `children` array. This structure is far more constrained and predictable for an LLM to generate correctly than raw HTML with its myriad optional attributes and closing tags.

## The AI Angle: Why This Matters
Current LLM-based UI generation tools output **HTML, JSX, or Python** code directly. This works but is brittle—models must understand the nuances, syntax quirks, and best practices of each target language. A misplaced `</div>` or incorrect prop name breaks the output.

Declare acts as a **high-fidelity intermediate representation**. An AI agent only needs to understand the limited, standardized Declare spec. A separate, reliable compiler (the "target runtime") then transforms that Declare code into flawless, production-ready code for the desired platform. This separation of concerns reduces LLM error rates and simplifies prompt engineering for UI tasks.

> **Bottom line:** Declare aims to be a compiler target for AI, turning vague "make a login screen" prompts into structured, portable UI definitions.

## Who Should Use Declare (And Who Shouldn't)
**Declare is immediately useful for:**
*   **AI Tool Builders:** Developers creating agents or copilots that generate interfaces. Using Declare as the output format simplifies validation and post-processing.
*   **Cross-Platform Projects:** Teams targeting web, mobile, and desktop from a single UI definition, where Declare could serve as a potential intermediary format.
*   **Prototyping Tools:** Applications where speed of UI generation from text is more critical than the final, polished code output.

**Skip Declare for now if:**
*   You need a production-ready framework today. Declare is a **specification and early prototype**.
*   Your workflow is locked into a single platform (e.g., only React). The overhead may not be justified.
*   You require complex, interactive UI behaviors. The spec currently focuses on structure and basic properties.

## Alternatives and Comparisons
Declare enters a space occupied by established UI languages and newer AI-focused projects.

| Feature | Declare | HTML/JSX | OpenAI's GPTs UI Builder | Figma to Code Tools |
|---------|---------|-----------|--------------------------|----------------------|
| **Primary Audience** | AI + Developers | Developers | End Users (No-Code) | Designers + Developers |
| **Output** | Declare JSON | Renderable Code | Proprietary GUI | HTML/Tailwind/React |
| **AI-Gen Friendliness** | **High** (structured, simple) | Medium (prone to syntax errors) | High (fully hidden) | Medium (varies by tool) |
| **Portability** | **High** (theoretical multi-platform) | Low (web-only) | None (locked platform) | Medium (often web-only) |
| **Current State** | Spec / Prototype | Mature Standard | Production Service | Mature Services |

The key distinction is intent. Unlike **OpenAI's GPTs UI builder**, which hides the code entirely, Declare exposes a machine-optimized code layer. Unlike **HTML**, it sacrifices expressiveness and direct renderability for generation reliability and portability.

## How to Try Declare
As an early-stage project, hands-on experimentation involves exploring the spec and community examples.

1.  **Read the Specification:** The [official Declare website](https://davidtemkin.github.io/declarelang/) details the language rationale and syntax.
2.  **Review Early Tools:** The associated [GitHub repository](https://github.com/davidtemkin/declarelang) contains a proof-of-concept parser and examples.
3.  **Experiment with LLMs:** The most practical test is to prompt a model like **Claude 3 Opus** or **GPT-4** with the Declare spec and ask it to generate UI definitions. System prompts can be crafted to enforce Declare output exclusively.
4.  **Join the Discussion:** The [Hacker News thread](https://news.ycombinator.com/item?id=40698783) contains feedback from early adopters and technical questions.

{% details "Sample Prompt for LLM Experimentation" %}
Use a system prompt like:
"You are a UI specialist that outputs code exclusively in the Declare language. Declare is a JSON-based UI DSL. Always respond with a valid JSON object conforming to the Declare spec for the user's request."

A user prompt could be: "Create a settings screen with a header, a toggle for 'Dark Mode', and a save button."
The expected output is a Declare JSON object defining a `Container` with `Text`, `Toggle`, and `Button` children.
{% enddetails %}

## The Bottom Line
Declare is a compelling **thought experiment made concrete**. It directly addresses the structural unpredictability of LLM-generated code by proposing a minimalist, AI-optimized interchange format for UIs. While it lacks the ecosystem of mature alternatives, its value proposition for multi-platform AI coding tools is clear. Developers building the next wave of AI-assisted IDEs should examine its premises closely.

The success of such a language depends entirely on adoption—by compiler writers, framework authors, and ultimately, the AI models themselves. It represents a bet that the future of UI development involves not just AI writing our code, but humans and AI agreeing on a better language to use.