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

@robinpath/react

v0.1.1

Published

RobinPath React components — render forms from RobinPath schemas

Downloads

9

Readme

@robinpath/react

Enterprise-grade React form renderer for RobinPath schemas. Render dynamic forms from JSON — works with React 18+, Next.js, Remix, Gatsby, Astro, and any React environment.

Install

npm install @robinpath/react

Quick Start

From a schema (local)

import { FormRenderer } from '@robinpath/react';
import type { FormSchema } from '@robinpath/react';

const schema: FormSchema = {
  config: { title: 'Contact Us', submitLabel: 'Send' },
  fields: [
    { name: 'name', type: 'text', label: 'Name', required: true, order: 0 },
    { name: 'email', type: 'email', label: 'Email', required: true, order: 1 },
    { name: 'message', type: 'textarea', label: 'Message', order: 2 },
  ],
};

function App() {
  return (
    <FormRenderer
      schema={schema}
      onSubmit={(values) => console.log(values)}
      theme="dark"
    />
  );
}

From CDN (RobinPath snippet)

import { RobinPathForm } from '@robinpath/react';

function App() {
  return (
    <RobinPathForm
      snippetId="your-snippet-id"
      onSubmit={(values) => console.log(values)}
      onResult={(result) => console.log(result)}
    />
  );
}

Programmatic Control

Access the form imperatively via ref:

import { useRef } from 'react';
import { FormRenderer } from '@robinpath/react';
import type { FormHandle } from '@robinpath/react';

function App() {
  const formRef = useRef<FormHandle>(null);

  return (
    <>
      <FormRenderer ref={formRef} schema={schema} onSubmit={handleSubmit} />
      <button onClick={() => formRef.current?.submit()}>Submit Externally</button>
      <button onClick={() => formRef.current?.reset()}>Reset</button>
      <button onClick={() => formRef.current?.setValue('name', 'John')}>Set Name</button>
    </>
  );
}

FormHandle API

| Method | Description | |--------|-------------| | submit() | Submit the form programmatically | | reset() | Reset to initial values | | validate() | Validate all fields, returns ValidationError[] | | getValues() | Get current form values | | setValue(name, value) | Set a single field value | | setValues(values) | Set multiple values | | setError(name, message) | Set a field error | | clearErrors() | Clear all errors | | focus(name) | Focus a specific field | | getState() | Get full form state |

Props

FormRenderer

| Prop | Type | Default | Description | |------|------|---------|-------------| | schema | FormSchema | required | Form schema from RobinPath | | initialValues | FormValues | — | Override default values | | onChange | (values, fieldName) => void | — | Called on every field change | | onSubmit | (values) => void \| Promise | — | Called on valid submit | | onValidationError | (errors) => void | — | Called when validation fails | | onBlur | (fieldName, value) => void | — | Called on field blur | | theme | 'dark' \| 'light' | 'dark' | Theme preset | | className | string | — | Root element class | | style | CSSProperties | — | Root element styles | | disabled | boolean | false | Disable all fields | | hideSubmit | boolean | false | Hide submit button | | submitLabel | string | 'Submit' | Custom submit text | | showBranding | boolean | false | Show RobinPath footer | | validateOnBlur | boolean | true | Validate on blur | | validateOnChange | boolean | false | Validate on change | | focusOnError | boolean | true | Focus first error on submit | | renderField | (field, props) => ReactNode | — | Custom field renderer | | renderSubmit | (props) => ReactNode | — | Custom submit button | | idPrefix | string | 'rp' | ID prefix for SSR |

RobinPathForm

Extends all FormRenderer props, plus:

| Prop | Type | Default | Description | |------|------|---------|-------------| | snippetId | string | required | RobinPath snippet ID | | cdnUrl | string | 'https://cdn.robinpath.com' | CDN base URL | | executeOnSubmit | boolean | true | Execute script on CDN | | onResult | (result) => void | — | Execution result callback | | renderLoading | () => ReactNode | — | Custom loading UI | | renderError | (error) => ReactNode | — | Custom error UI |

Field Types

All 19 field types supported:

text · textarea · password · email · url · phone · number · range · select · multiselect · radio · checkbox · date · time · datetime · file · hidden · color · json

Custom Field Renderer

<FormRenderer
  schema={schema}
  renderField={(field, props) => (
    <div key={field.name}>
      <label>{field.label}</label>
      <input
        value={String(props.value ?? '')}
        onChange={(e) => props.onChange(e.target.value)}
        onBlur={props.onBlur}
      />
      {props.error && props.touched && <span>{props.error}</span>}
    </div>
  )}
  onSubmit={handleSubmit}
/>

Conditional Fields

Fields can be conditionally visible based on other field values:

const schema: FormSchema = {
  config: {},
  fields: [
    { name: 'hasCompany', type: 'checkbox', label: 'I have a company', order: 0 },
    { name: 'company', type: 'text', label: 'Company Name', order: 1, showWhen: 'hasCompany' },
    { name: 'role', type: 'select', label: 'Role', order: 2, options: [
      { value: 'dev', label: 'Developer' },
      { value: 'manager', label: 'Manager' },
    ]},
    { name: 'team_size', type: 'number', label: 'Team Size', order: 3, showWhen: 'role', showWhenValue: 'manager' },
  ],
};

Context Hook

Access form state from nested components:

import { useFormContext } from '@robinpath/react';

function StatusBar() {
  const { values, errors, isSubmitting } = useFormContext();
  return <div>Fields filled: {Object.values(values).filter(Boolean).length}</div>;
}

Accessibility

WCAG 2.1 AA compliant:

  • aria-invalid on error fields
  • aria-describedby linking errors and descriptions
  • aria-required on required fields
  • role="alert" on error messages
  • role="radiogroup" on radio groups
  • aria-live="polite" on success state
  • Keyboard navigable
  • Auto-focus first error on submit

Architecture

  • useSyncExternalStore — React 18+ concurrent mode safe, no tearing
  • memo field renderer — only rerenders when own value/error/touched changes
  • Error boundary — graceful crash recovery
  • Zero CSS dependencies — inline styles via CSS variables
  • 29KB bundle — tree-shakeable ES module

License

MIT