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

@toon-ui/react

v2.0.1

Published

React runtime and component registry for ToonUI.

Readme

@toon-ui/react

@toon-ui/react is the explicit React integration layer for ToonUI.

Use it when you want to own the UI adapter instead of relying on the default client package.

Quick path

  1. Server: createToonProtocol() from @toon-ui/core.
  2. Client: build an adapter with createToonReactAdapter().
  3. Create a runtime with createToonReactRuntime({ adapter }).
  4. Render with ToonMessage or ToonRenderer.
  5. Reinject interactions with runtime.messages.*.

Install

In a React host app:

pnpm add @toon-ui/core @toon-ui/react

Do NOT force react or react-dom in this command. Those belong to the host framework and should already be managed by the app.

Main exports

  • createToonReactAdapter()
  • createToonAdapter()
  • mergeToonComponentRegistry()
  • createToonReactRuntime()
  • assertToonReactAdapter()
  • ToonMessage
  • ToonRenderer
  • extractToonMarkdown
  • getToonButtonProps()
  • getToonInputProps()
  • getToonTextareaProps()
  • getToonCheckboxProps()
  • basicPreset()
  • useToonAction()

Recommended adapter pattern

import {
  createToonReactAdapter,
  createToonReactRuntime,
  getToonButtonProps,
  type ToonButtonComponentProps,
} from '@toon-ui/react';

function MyButton(props: ToonButtonComponentProps) {
  return <button {...getToonButtonProps(props)}>{props.node.label}</button>;
}

const adapter = createToonReactAdapter({
  level: 'default',
  components: {
    button: MyButton,
  },
});

const runtime = createToonReactRuntime({ adapter });

Why adapters matter

A raw component registry was weak API design.

An adapter makes the contract explicit:

  • what UI you replace
  • what defaults remain
  • where interaction wiring comes from
  • what coverage is still missing via adapter.meta.missingKeys
  • whether the adapter is minimal, default, or strict
console.log(adapter.meta.level);
console.log(adapter.meta.providedKeys);
console.log(adapter.meta.missingKeys);

Use the levels like this:

  • default -> merges ToonUI defaults plus your overrides
  • minimal -> only what you register manually
  • strict -> requires full coverage and throws if any adapter slot is missing

Reinjecting interactions

onReply={(payload) => {
  const message = runtime.messages.toModelMessage(payload);
  console.log(message.content);
  console.log(message.displayContent);
}}

For useChat-style state:

const next = runtime.messages.toUIMessage(payload);

Hooks

useToonAction() now mirrors the protocol mental model:

const { events, messages } = useToonAction();