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

@reactive-forge/ui

v1.0.0

Published

UI part of the Reactive Forge.

Downloads

49

Readme

@reactive-forge/ui

UI part of the Reactive Forge.

Getting started

To start using the ui, you need to provide some components. To do that, you can use ComponentLibraryProvider component:

import {components} from "path/to/reactive-forge/generated/folder";
import {ComponentLibraryProvider} from "@reactive-forge/ui";
import React, {ReactNode} from "react";

export const ComponentProvider: FC<{ children?: ReactNode }> = ({children}) =>
    <ComponentLibraryProvider components={components}>
        {children}
    </ComponentLibraryProvider>

Rendering components

ComponentRenderer is responsible for rendering components. To use it, you need to provide file path, component name, args and context, either by provider:

import {ComponentRenderer, ComponentContext, ComponentContextProvider, useComponentLibrary} from "@reactive-forge/ui";
import {useMemo} from "react";

const Empty: FC = () => {
    const library = useComponentLibrary()
    const context = useMemo(() => new ComponentContext(library), [library])
    
    return <ComponentContextProvider context={context}>
        <ComponentRenderer path="$" name="Empty" args={{}}/>
    </ComponentContextProvider>
}

or parameter:

import {ComponentRenderer, ComponentContext, ComponentContextProvider, useComponentLibrary} from "@reactive-forge/ui";
import {useMemo} from "react";

const Empty: FC = () => {
    const library = useComponentLibrary()
    const context = useMemo(() => new ComponentContext(library), [library])
    
    return <ComponentRenderer context={context} path="$" name="Empty" args={{}}/>
}

ComponentRenderer checks the type of args before rendering the component, to ensure type safety.

Constructing values

If you tried to pass some arguments you may have noticed, that it accepts typed wrappers around values instead of plain js values.

They are called constructs. Constructs carry type information with them and can be easily serialized to and from the json files. To make working with them easier, there exists utils object c:

import { c } from "@reactive-forge/ui";

const numberConstruct = c.number(5)
const stringConstruct = c.string("test")
const objectConstruct = c.object({
    key: c.string("key"),
    value: c.date(new Date())
})

You can also load values from file:

import {constructSchema} from "@reactive-forge/ui";
import fs from "fs";

const content = JSON.parse(fs.readFileSync("someFile.json", { encoding: 'utf-8' }).toString())
const value = constructSchema.value.safeParse(content)

if (!value.success)
    throw new Error("error")

console.log(value.data)

And then pass them to the renderer:

import {ComponentRenderer} from "@reactive-forge/ui";

<ComponentRenderer path="@/Text" name="Title" args={{ title: c.string("some text") }} />

Editor

Reactive Forge also provides utilities for creating ui for building these constructs. Basic editor example using useComponentPreview looks like this:

import {ComponentRenderer, useComponentPreview} from "@reactive-forge/ui";

const Preview: FC<{ path: string, name: string }> = ({path, name}) => {
    const preview = useComponentPreview(path, name)

    // preview will be null when component is not found
    if (!preview) return null

    // rendererProps may be null when props are invalid
    const {editorProps, rendererProps} = preview

    return <div>
        <Construct {...editorProps} />
        {rendererProps && <ComponentRenderer {...rendererProps} />}
    </div>
}

Built-in ui is pretty basic, but you can customize it by providing your own input components with EditorComponentsProvider:

import {EditorComponentsProvider} from "@reactive-forge/ui";
import React, {ReactNode} from "react";

const CustomEditorComponents: FC<{ children?: ReactNode }> = ({ children }) =>
    <EditorComponentsProvider value={{
        NullInput: YourNullInput,
        UndefinedInput: YourUndefinedInput,
        TextInput: YourTextInput,
        ...
    }}>
        {children}
    </EditorComponentsProvider>