Joy DOM

Quickstart

Write your first Joy DOM document, then render it natively on any platform.

A Joy DOM document is plain JSON. Write it once, then render it natively on the web, Apple platforms, or Android. This page writes a minimal document; pick your platform below to render it.

Write a document

Save this as hello.json. Every document has the same four top-level fields:

{
  "version": 1,
  "style": {
    ".stack": {
      "display": "flex",
      "flexDirection": "column",
      "gap": {
        "value": 12,
        "unit": "px"
      },
      "padding": {
        "value": 24,
        "unit": "px"
      }
    },
    "h1": {
      "display": "flex",
      "fontSize": {
        "value": 32,
        "unit": "px"
      }
    },
    "p": {
      "display": "flex",
      "fontSize": {
        "value": 16,
        "unit": "px"
      },
      "color": "#475569"
    }
  },
  "breakpoints": [],
  "layout": {
    "type": "div",
    "props": {
      "className": ["stack"]
    },
    "children": [
      {
        "type": "h1",
        "children": ["Hello Joy DOM"]
      },
      {
        "type": "p",
        "children": ["Rendered natively from JSON."]
      }
    ]
  }
}

Why does every node have `display: "flex"`?

Joy DOM requires display to be set explicitly on every node. See §4.4 Special rules in the specification.

Render it

The same document renders on every platform. Pick yours:

What just happened

  • version: 1 declares the spec revision (see §2.1).
  • style defines shared rules keyed by selector (see §4 Styles).
  • breakpoints is empty - responsive overrides arrive in tutorial chapter 3.
  • layout is the root node tree (see §3 Nodes).

Where next

Tutorial - walk through the document model, styling, breakpoints, custom components, and publishing as one connected story.

Specification - the numbered, deep-linkable contract for every supported node, property, and breakpoint condition.

Use cases - copy-paste documents for invoices, reports, forms, and resumes.

On this page