npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

domino-ui

v0.2.1

Published

JSON-to-React UI renderer for AI-generated layouts

Readme

domino-ui

A React library for rendering AI-generated JSON layouts into UI. Each node renders the next — like dominoes.

Pass a structured JSON layout from your LLM and domino-ui cascades it into a fully composed React UI with charts, tables, summaries, collections, and text blocks.

Install

npm install domino-ui

Peer dependencies

npm install react recharts lucide-react clsx tailwind-merge

Quick start

import { UiRenderer } from "domino-ui";
import type { UiLayout } from "domino-ui";

const layout: UiLayout = {
  kind: "column",
  children: [
    {
      kind: "block",
      style: "subheading",
      text: "Monthly Overview",
    },
    {
      kind: "row",
      children: [
        {
          kind: "summary",
          id: "total",
          heading: "Total Spent",
          primary: "$2,340",
          secondary: "+12% vs last month",
          sentiment: "down",
        },
        {
          kind: "summary",
          id: "savings",
          heading: "Saved",
          primary: "$560",
          secondary: "On track",
          sentiment: "up",
        },
      ],
    },
    {
      kind: "visual",
      variant: "donut",
      points: [
        { label: "Food", value: 820, share: 35 },
        { label: "Transport", value: 470, share: 20 },
        { label: "Shopping", value: 610, share: 26 },
        { label: "Other", value: 440, share: 19 },
      ],
    },
  ],
};

export default function App() {
  return <UiRenderer layout={layout} />;
}

Node types

block

A text element. Three styles:

| style | description | |-------|-------------| | "subheading" | Small uppercase section label | | "body" | Regular paragraph text | | "insight" | Highlighted callout with a star icon |

{
  kind: "block",
  style: "subheading" | "body" | "insight",
  text: string,
}

summary

A metric card — heading, primary value, optional secondary text with sentiment colouring.

{
  kind: "summary",
  id: string,
  heading: string,
  primary: string,
  secondary?: string,
  sentiment?: "up" | "down" | "neutral",
}

visual

A chart. "donut" renders a donut/pie chart with a custom legend. "bars" renders a bar chart.

{
  kind: "visual",
  variant: "donut" | "bars",
  points: Array<{
    label: string,
    value: number,
    share?: number,   // percentage 0-100, shown in tooltip and legend
  }>,
}

table

A data table with up to 4 columns, expand/collapse for long lists.

{
  kind: "table",
  variant: "records",
  columns?: [string, string, string, string],  // defaults to ["Item","Category","Value","Date"]
  rows: Array<{
    id?: string,
    label: string,
    badge?: string,
    value: string | number,
    secondary?: string,
  }>,
}

collection

A list of newly created items with per-item undo support.

{
  kind: "collection",
  variant: "items",
  text: string,   // header/confirmation message
  items: Array<{
    id?: string,
    label: string,
    badge?: string,
    value: string | number,
    icon?: string,
  }>,
}

row

Lays children out horizontally in equal-width columns.

{
  kind: "row",
  children: UiNode[],
}

column

Lays children out vertically with a gap.

{
  kind: "column",
  children: UiNode[],
}

UiRenderer props

<UiRenderer
  layout={layout}           // required — UiLayout
  callbacks={callbacks}     // optional — { onUndo?: (ids: string[]) => Promise<void> }
  className={className}     // optional — CSS class on the root div
/>

Undo callbacks

The collection node shows an undo button per item. Wire it up via callbacks:

<UiRenderer
  layout={layout}
  callbacks={{
    onUndo: async (ids) => {
      await deleteItems(ids);
    },
  }}
/>

Using with an LLM

The library is designed around a JSON schema your LLM can output directly. Prompt your model to return a UiResponse:

import type { UiResponse } from "domino-ui";

// Parse LLM output
const response: UiResponse = JSON.parse(llmOutput);

// Render
<UiRenderer layout={response.layout} />

Example system prompt snippet:

Respond with a JSON object matching this shape:
{
  "layout": {
    "kind": "column",
    "children": [ ...UiNode[] ]
  }
}

Node kinds: block | summary | visual | table | collection | row | column

Styling

domino-ui uses CSS variables for theming. It works out of the box with Tailwind CSS and shadcn/ui. Override these variables in your CSS to match your design system:

:root {
  --background: ...;
  --foreground: ...;
  --card: ...;
  --border: ...;
  --muted: ...;
  --muted-foreground: ...;
  --popover: ...;
  --popover-foreground: ...;
  --primary: ...;
  --chart-1: ...;
  --chart-2: ...;
  --chart-3: ...;
  --chart-4: ...;
  --chart-5: ...;
}

License

MIT