Json Uiのロゴ

Json Ui

組織人気
actionbook
json-ui

重要:json-uiコンポーネントのレンダリングと開発に使用します。次の内容がきっかけで起動します: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 渲染、组件目录、报告渲染、多语言、中英文切换

Add to TypingMind

概要

公開者actionbook
リポジトリactionbook
スキル名json-ui
スター
1.6K
フォーク
120
同梱ファイル
指示のみ
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    actionbookがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Json Ui」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/actionbook/actionbook/tree/main/playground/json-ui-skill
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでJson Uiを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にJson Uiを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Json Uiは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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

よくある質問

AIスキル「Json Ui」では何ができますか?

重要:json-uiコンポーネントのレンダリングと開発に使用します。次の内容がきっかけで起動します: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 渲染、组件目录、报告渲染、多语言、中英文切换

TypingMindでJson Uiを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Json Uiはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにJson Uiをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/actionbook/actionbook/tree/main/playground/json-ui-skillを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Json Uiを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Json Uiで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもJson Uiを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Json Ui」は無料ですか?

はい。actionbookがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇