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

lexio

v0.1.3

Published

Quickest way to production grade RAG UI.

Readme

Lexio is a powerful React library for building Retrieval-Augmented Generation (RAG) interfaces, handling complex workflows out of the box while remaining simple to use and highly customizable.

It supports multiple document types (PDF, HTML, Markdown, Text, Excel) with advanced features like streaming responses, source highlighting, and a comprehensive state management system.

Developers can use ready-made components or easily build custom ones using React hooks and the flexible action handler pattern.

RAG UI Example

Quick Start

You can install the library with npm or yarn:

npm install lexio

To use the GUI components, you need to provide an action handler to the LexioProvider context:

const App = () => (
  <LexioProvider
    onAction={(action, messages, sources, activeSources, selectedSource) => {
      // Handle user messages
      if (action.type === 'ADD_USER_MESSAGE') {
        return {
          // Return sources as a Promise that resolves to Source[]
          sources: fetchSources(),
          // Return a response as a Promise or use streaming
          response: Promise.resolve("This is a sample response based on the retrieved documents.")
        };
      }
      // Handle source selection
      if (action.type === 'SET_SELECTED_SOURCE' && action.sourceObject) {
        return {
          sourceData: fetchSourceContent(action.sourceObject.id)
        };
      }
      return undefined;
    }}
  >
    <ChatWindow markdown={true} />
    <AdvancedQueryField />
    <SourcesDisplay />
    <ContentDisplay />
  </LexioProvider>
);

Follow the documentation to learn more about the library.

Dependencies

Lexio has minimal core dependencies, but some advanced components require additional packages that are not installed by default:

  • SpreadsheetViewer: For Excel/spreadsheet file viewing, you'll need to install:

    npm install exceljs xlsx @tanstack/react-table @tanstack/react-virtual
  • Explanations Module: For advanced explanation features, you'll need to install:

    npm install compromise js-tiktoken sbd @types/sbd

These dependencies are dynamically imported when the components are used, but you must install them yourself to avoid runtime errors.

Core Concepts

🔄 LexioProvider

The LexioProvider is the core component that provides the context for all Lexio UI components:

  • It manages the shared state for all UI components
  • It processes user actions through the onAction ActionHandler
  • It handles error states and loading indicators
  • It provides configuration options for timeouts and other settings

🧩 UI Components

Lexio provides several ready-to-use UI components:

  • ChatWindow: 💬 Displays the conversation history and AI responses with markdown support
  • AdvancedQueryField: 📝 Input field for user messages with optional advanced features
  • SourcesDisplay: 📚 Shows retrieved sources with metadata and selection capabilities
  • ContentDisplay: 📄 Renders the content of selected sources with highlighting
  • ErrorDisplay: ❗ Shows error messages and loading states

🔗 React Hooks

Lexio provides a set of React hooks that allow you to interact with the state and trigger actions from your custom components:

  • useSources: 📊 Access and manipulate source-related state
  • useMessages: 💌 Access and manipulate message-related state
  • useStatus: ⏳ Access loading and error states