Json Ui logo

Json Ui

OrganizationPopular
actionbook
json-ui

CRITICAL: Use for json-ui component rendering and development. Triggers on: json-ui, json render, component catalog, report render, HTML report, I18nString, i18n, bilingual, language switch, dual language, PaperHeader, AuthorList, Abstract, MetricsGrid, Section, Highlight, Zod schema, catalog.ts, cli.ts, components/index.tsx, "how to add a component", "how to render JSON", JSON 渲染, 组件目录, 报告渲染, 多语言, 中英文切换

Overview

Publisheractionbook
Repositoryactionbook
Skill namejson-ui
Stars
1.6K
Forks
120
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by actionbook on GitHub. Read the source before you install it.

Installation

Install the Json Ui AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/actionbook/actionbook/tree/main/playground/json-ui-skill
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/actionbook/actionbook.git /tmp/actionbook
mkdir -p .claude/skills
cp -r /tmp/actionbook/playground/json-ui-skill .claude/skills/json-ui
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Json Ui in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Json Ui on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Json Ui is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

json-ui

Version: 1.0.0 | Last Updated: 2026-01-29

You are an expert at the json-ui package — a JSON-to-HTML report renderer with React component support, bilingual i18n, and a CLI tool. Help users by:

  • Writing components: Add new component types following existing patterns
  • Rendering reports: Generate HTML from JSON report definitions
  • Debugging: Fix rendering, build, or i18n issues
  • Answering questions: Explain architecture, component catalog, data flow

Quick Reference

TaskFilePattern
Define component schemasrc/catalog.tsAdd Zod schema + export in catalog object
Render component (HTML)src/cli.tsAdd case in renderNode() switch
Render component (React)src/components/index.tsxExport React FC using catalog types
Add i18n textAny JSON{ "en": "Hello", "zh": "你好" } or plain "Hello"
Buildterminalpnpm build (uses tsup, outputs ESM + DTS)
Render reportterminaljson-ui render report.json [-o out.html] [--no-open]

Documentation

Refer to local source files for detailed documentation:

  • packages/json-ui/src/catalog.ts - All Zod schemas and type definitions
  • packages/json-ui/src/cli.ts - HTML renderer and CLI entry point
  • packages/json-ui/src/components/index.tsx - React component implementations

IMPORTANT: Documentation Completeness Check

Before answering questions, Claude MUST:

  1. Read the relevant source file(s) listed above
  2. If file read fails: Inform user "本地文档不完整,建议更新"
  3. Still answer based on SKILL.md patterns + built-in knowledge

Architecture

JSON Report Format

Reports are trees of nodes:

json
{
  "type": "Report",
  "props": { "title": "My Report", "theme": "auto" },
  "children": [
    {
      "type": "Section",
      "props": { "title": "Overview", "icon": "bulb" },
      "children": [
        { "type": "Abstract", "props": { "text": "..." } }
      ]
    }
  ]
}

Three Rendering Layers

LayerFileOutputUse Case
Zod Schemascatalog.tsType definitionsValidation, type safety
HTML Renderercli.tsStatic HTML stringCLI render command
React Componentscomponents/index.tsxReact elementsEmbedded usage

Data Flow

JSON file → CLI parse → renderNode() recursion → HTML string → file write → browser open

Component Catalog (38 types)

Layout

ComponentKey PropsDescription
Reporttitle?, themeRoot wrapper, 800px max-width
Sectiontitle, icon?, collapsible?Collapsible section with header
Gridcols, gapCSS grid layout
Cardvariant, padding, shadowCard container

Paper Info

ComponentKey PropsDescription
PaperHeadertitle, arxivId, date, categories?Paper title + metadata
AuthorListauthors, layout?, maxVisible?Author names + affiliations
Abstracttext, highlights?, maxLength?Abstract with keyword highlighting
TagListtags, variantTag/category pills

Content

ComponentKey PropsDescription
ContributionListitems, numbered?Numbered contributions with badges
MethodOverviewsteps, showConnectors?Step-by-step method pipeline
Highlighttext, type, source?Blockquote (quote/important/warning/code)
KeyPointicon, title, descriptionIcon + title + description
CodeBlockcode, language, showLineNumbers?Syntax-highlighted code
ProsecontentMarkdown content block
Callouttype, title?, contentInfo/tip/warning/important/note box

Rich Content

ComponentKey PropsDescription
Imagesrc, alt?, caption?, width?Single image
Figureimages, caption?, label?Multi-image figure
Formulalatex, block?, label?LaTeX formula
DefinitionListitemsTerm-definition pairs
Theoremtype, number?, title?, contentTheorem/lemma/proposition
Algorithmtitle, steps, caption?Algorithm pseudocode
ResultsTablecolumns, rows, highlights?Results with best-cell highlighting

Data Display

ComponentKey PropsDescription
Metriclabel, value, trend?, icon?Single metric card
MetricsGridmetrics, cols?Grid of metric cards
Tablecolumns, rows, striped?, caption?Data table

Interactive

ComponentKey PropsDescription
LinkButtonhref, label, icon?, external?Styled link button
LinkGrouplinks, layout?Group of link buttons

Brand

ComponentKey PropsDescription
BrandHeaderbadge?, poweredBy?, showBadge?AI-generated badge header
BrandFootertimestamp, attribution?, disclaimer?Footer with attribution

I18n System

Backward-Compatible Bilingual Strings

The I18nString type accepts both plain strings and bilingual objects:

typescript
// catalog.ts
export const I18nString = z.union([
  z.string(),
  z.object({ en: z.string(), zh: z.string() }),
]);

JSON Usage

json
// Plain string (backward compatible)
{ "title": "Hello World" }

// Bilingual object
{ "title": { "en": "Hello World", "zh": "你好世界" } }

HTML Rendering (cli.ts)

For HTML output, i18n strings render as dual spans:

typescript
// renderI18n() outputs:
<span class="i18n-en">Hello</span><span class="i18n-zh">你好</span>

// CSS controls visibility:
html[lang="en"] .i18n-zh { display: none; }
html[lang="zh"] .i18n-en { display: none; }

For HTML attributes (alt, title) where only a plain string works:

typescript
// resolveI18n() picks one language:
const alt = resolveI18n(props.alt, 'en'); // returns plain string

React Rendering (components/index.tsx)

typescript
// Use <I18nText> component for JSX:
<I18nText value={props.title} />

// Use resolveI18nStr() for plain string contexts:
const altText = resolveI18nStr(props.alt, 'en');

Language Switcher

  • Fixed top-right button: EN | 中文
  • Toggles <html lang="en|zh"> attribute
  • Persists choice via localStorage.getItem('json-ui-lang')

Key Patterns

Pattern 1: Adding a New Component

  1. Define schema in catalog.ts:
typescript
export const MyWidgetSchema = z.object({
  label: I18nString,        // Use I18nString for user-visible text
  count: z.number(),        // Use z.string()/z.number() for data
  variant: VariantType.default('default'),
});

// Add to catalog object:
export const catalog = {
  // ...existing...
  MyWidget: MyWidgetSchema,
} as const;

// Export type:
export type MyWidgetProps = z.infer<typeof MyWidgetSchema>;
  1. Add HTML renderer in cli.ts renderNode() switch:
typescript
case 'MyWidget': {
  const { label, count, variant } = props;
  return `<div class="my-widget ${variant}">
    <span>${renderI18n(label)}</span>
    <strong>${escapeHtml(String(count))}</strong>
  </div>`;
}
  1. Add React component in components/index.tsx:
typescript
export const MyWidget: React.FC<MyWidgetProps> = ({ label, count, variant = 'default' }) => (
  <div className={`my-widget ${variant}`}>
    <span><I18nText value={label} /></span>
    <strong>{count}</strong>
  </div>
);

Pattern 2: Handling I18n in Special Cases

For text that needs processing (e.g., Abstract highlights):

typescript
// HTML (cli.ts) - process each language separately:
if (isI18n(text)) {
  return `<span class="i18n-en">${processText(text.en)}</span>
          <span class="i18n-zh">${processText(text.zh)}</span>`;
} else {
  return processText(String(text));
}

// React (components/index.tsx):
if (typeof text === 'object' && 'en' in text && 'zh' in text) {
  return (
    <>
      <span className="i18n-en" dangerouslySetInnerHTML={{ __html: processText(text.en) }} />
      <span className="i18n-zh" dangerouslySetInnerHTML={{ __html: processText(text.zh) }} />
    </>
  );
}

Common Errors

ErrorCauseSolution
Type 'I18nStringType' is not assignable to 'ReactNode'Passing i18n object directly to JSXWrap with <I18nText value={...} />
Property 'length' does not exist on type 'I18nStringType'Calling string methods on i18n valueUse type guard: typeof text === 'string' ? text : text.en
Images not loading from arxivcrossorigin="anonymous" on <img>Remove crossorigin; keep only referrerpolicy="no-referrer"
Language switcher not workingMissing CSS rules or JSEnsure html[lang] .i18n-* CSS rules and toggle JS are in template
Build fails with type errorsSchema changed but components not updatedUpdate all three files: catalog, cli, components

CRITICAL: Image Handling

Do NOT use crossorigin="anonymous" on <img> tags.

Sites like arxiv.org do not send CORS headers. Adding crossorigin="anonymous" causes the browser to require CORS, which fails and blocks the image.

html
<!-- WRONG - breaks images from arxiv and similar sites -->
<img src="..." referrerpolicy="no-referrer" crossorigin="anonymous" />

<!-- CORRECT -->
<img src="..." referrerpolicy="no-referrer" />

Chinese Translation Guidelines

When writing Chinese translations for ML/AI papers:

WrongCorrectReason
评论器价值函数(critic)Standard ML term
运行估计滑动估计Running estimate = 滑动估计
重加权因子加权系数More natural Chinese
不断演化的动态更新的Clearer meaning
简单修复改动小Academic tone

Build & CLI

bash
# Build (ESM + DTS via tsup)
cd packages/json-ui && pnpm build

# Render report to HTML
node dist/cli.js render example-report-rich.json

# With options
node dist/cli.js render report.json -o output.html --no-open

When Writing Code

  1. Always use I18nString for user-visible text properties in schemas
  2. Always handle both string and {en, zh} forms in renderers
  3. Never use crossorigin="anonymous" on img tags
  4. Keep referrerpolicy="no-referrer" on img tags for privacy
  5. Test with pnpm build after any schema or component changes
  6. Update all three layers (catalog, cli, components) when adding components

Frequently asked questions

What does the Json Ui AI skill do?

CRITICAL: Use for json-ui component rendering and development. Triggers on: json-ui, json render, component catalog, report render, HTML report, I18nString, i18n, bilingual, language switch, dual language, PaperHeader, AuthorList, Abstract, MetricsGrid, Section, Highlight, Zod schema, catalog.ts, cli.ts, components/index.tsx, "how to add a component", "how to render JSON", JSON 渲染, 组件目录, 报告渲染, 多语言, 中英文切换

Why use Json Ui on TypingMind?

Because you install it once and use it with any model. Json Ui is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Json Ui in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/actionbook/actionbook/tree/main/playground/json-ui-skill. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Json Ui?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Json Ui?

As many as you like. As long as a model supports skills, you can use Json Ui with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Json Ui AI skill free?

Yes. It is published on GitHub by actionbook under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇