E ember-json-render
Ember adapter for json-render

JSON specs.
Real Ember components.

Bring catalog-driven generative UI to Ember. Keep your component vocabulary in your app and render the same portable specs used across the json-render ecosystem.

$ npm install ember-json-render @json-render/core
Ember 5 · 6 · 7Glimmer componentsShared json-render spec
01 / Quick start

Connect your catalog to the renderer.

Register ordinary Glimmer components, describe a flat UI spec, and pass both to <JsonRenderer>.

1

Make a catalog component

Components receive resolved @props and render nested spec children through their block.

import Component from '@glimmer/component';

interface Args {
  props: { title?: string };
}

export default class UiCard
  extends Component<{ Args: Args }> {}
<section class="card">
  {{#if @props.title}}
    <h2>{{@props.title}}</h2>
  {{/if}}
  {{yield}}
</section>
2

Register the vocabulary

Keys in the registry are the component types the spec is allowed to request.

import { defineRegistry } from 'ember-json-render';
import UiCard from './components/ui-card';
import UiButton from './components/ui-button';

export const registry = defineRegistry({
  Card: UiCard,
  Button: UiButton,
});
3

Render a spec

Specs use the upstream flat format and can be created by hand or generated by your server.

const spec = {
  root: 'card',
  state: { count: 0 },
  elements: {
    card: {
      type: 'Card',
      props: { title: 'Hello' },
      children: ['button'],
    },
    button: {
      type: 'Button',
      props: { label: 'Continue' },
      on: { press: { action: 'continue' } },
    },
  },
};
<JsonRenderer
  @spec={{this.spec}}
  @registry={{this.registry}}
  @actions={{this.actions}}
  @onAction={{this.onAction}}
/>
02 / API

Small surface. Ember-native pieces.

Import the renderer from the addon and the spec/store types from the shared core contract.

JsonRenderer

Root component that owns or subscribes to a state store and renders a spec.

Required
@spec, @registry
Optional
@state, @store, @loading, @actions, @onAction, @onStateChange
defineRegistry(registry)

Type-preserving helper for mapping spec component names to Glimmer components.

const registry = defineRegistry({ Card, Button });
JsonRenderEvent

Action notification passed to @onAction: { name, params, elementKey }. Registered action handlers are supplied through @actions.

createJsonRenderUIStream(options)

Tracked client for a SpecStream JSONL endpoint. Use send(prompt, options?), read spec, isStreaming, and error, and call stop() or clear() as needed.

const ui = createJsonRenderUIStream({ api: '/api/generate' });
await ui.send('A dashboard for weekly sales');
// Render ui.spec with JsonRenderer while ui.isStreaming.
03 / Features

Use the shared spec vocabulary.

The Ember adapter focuses on translating spec elements into your components. Catalog schemas and prompts come from @json-render/core.

▦

Catalog registry

Only component types registered by your application can render.

↳

Nested children

Render flat keyed specs as nested Glimmer component blocks.

⌘

Reactive state

Seed state from a spec or app, or share a core StateStore.

⇄

Bound props

Pass @bind from your component to update declared state bindings.

◉

Actions & visibility

Handle catalog actions and render state-based conditions and repeated items.

≋

Portable specs

Keep the same json-render spec shape across Ember and other supported frameworks.

Preview releaseThe adapter is evolving. The renderer covers a practical core; check the repository README for current support and known gaps before adopting it in production.
Open source · Apache 2.0

Build the interface your spec describes.

Follow the project, report gaps, or contribute a renderer feature.

View on GitHub ↗