Skip to content

HTML Report Example

Node report = div({
    h1({ text("System Status Report") }),
    table({
        tr({ td({ text("CPU Usage") }), td({ text("75%") }) }),
        tr({ td({ text("Memory Usage") }), td({ text("68%") }) })
    })
});

Output JSON:

{
  "type": "div",
  "children": [
    {
      "type": "h1",
      "children": [ { "type": "#text", "props": { "value": "System Status Report" } } ]
    },
    {
      "type": "table",
      "children": [
        {
          "type": "tr",
          "children": [
            { "type": "td", "children": [ { "type": "#text", "props": { "value": "CPU Usage" } } ] },
            { "type": "td", "children": [ { "type": "#text", "props": { "value": "75%" } } ] }
          ]
        },
        {
          "type": "tr",
          "children": [
            { "type": "td", "children": [ { "type": "#text", "props": { "value": "Memory Usage" } } ] },
            { "type": "td", "children": [ { "type": "#text", "props": { "value": "68%" } } ] }
          ]
        }
      ]
    }
  ]
}