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

@m6d/cortex-react

v0.11.1

Published

React chat widget SDK for cortex servers

Readme

@m6d/cortex-react

React chat widget for cortex servers: streaming messages, tool call visualization, composer attachments, syntax highlighting, and i18n. Same features and pixel parity as @m6d/cortex-angular.

Usage

import { CortexChatWidget, type CortexReactConfig } from '@m6d/cortex-react';
import '@m6d/cortex-react/styles.css';
import '@m6d/cortex-react/theme.css';

const config = {
  locale: 'en',
  transport: {
    baseUrl: '/api/agents/assistant',
    getHeaders: () => ({ Authorization: `Bearer ${token}` }),
  },
} satisfies CortexReactConfig;

export function Chat() {
  return <CortexChatWidget config={config} className="block h-svh w-full" />;
}

CortexReactConfig is the shared CortexConfig plus a React-only toolComponents field (Record<string, ComponentType<CortexToolComponentInputs>>). Every other property, the client tools flow, and the media blocks are documented in packages/cortex-angular/README.md; only the toolComponents and injector rows are Angular-specific.

Custom parts

With slots you draw the widget's parts yourself: header, landing (the blank chat) and threadList (the history's list). Each is a component that takes the context the default is drawn from as its props, the same one Angular's cortexSlot templates get (fields listed in the Angular README). The landing's composer is a React node to place. Define slot components outside render: a new component each render remounts the part.

import {
  CortexChatWidget,
  type CortexHeaderContext,
  type CortexLandingContext,
  type CortexReactSlots,
} from '@m6d/cortex-react';

function Header(chat: CortexHeaderContext) {
  return (
    <div className="cortex-widget__chat-header">
      <div className="cortex-widget__chat-title-wrap">
        <p className="cortex-widget__chat-title">{chat.title ?? chat.agentName}</p>
      </div>
      <button className="cortex-widget__header-btn" onClick={chat.newChat}>
        +
      </button>
    </div>
  );
}

function Landing(landing: CortexLandingContext) {
  return (
    <div className="cortex-widget__landing">
      <h1>{landing.greeting}</h1>
      {landing.composer}
    </div>
  );
}

const slots = { header: Header, landing: Landing } satisfies CortexReactSlots;

<CortexChatWidget config={config} slots={slots} />;

The theming tokens and the table actions are the same as Angular's.

Requirements

  • React 18 or later
  • Peer dependencies: @tanstack/ai, @tanstack/ai-client, @tanstack/ai-react, marked, dompurify, highlight.js, plus the lazily loaded mermaid, vega, vega-lite, vega-embed, leaflet (and leaflet/dist/leaflet.css in your page for maps)