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

@squaredr/fieldcraft-react

v1.2.10

Published

React renderer for @squaredr/fieldcraft-core — 44 pre-built form fields, hooks, theming, and a pluggable field registry. Styled with Tailwind CSS via shadcn/ui primitives.

Downloads

2,080

Readme

@squaredr/fieldcraft-react

React renderer for @squaredr/fieldcraft-core — 44 pre-built form fields, hooks, theming, and a pluggable field registry. Styled with Tailwind CSS via shadcn/ui primitives.

Install

npm install @squaredr/fieldcraft-core @squaredr/fieldcraft-react

Quick Start

import { FormEngineRenderer } from "@squaredr/fieldcraft-react";
import "@squaredr/fieldcraft-react/styles.css";
import type { FormEngineSchema, FormResponse } from "@squaredr/fieldcraft-core";

const schema: FormEngineSchema = {
  id: "feedback",
  version: "1.0.0",
  title: "Feedback",
  submitAction: { type: "callback" },
  sections: [
    {
      id: "main",
      title: "Your Feedback",
      questions: [
        { id: "name", type: "short_text", label: "Name", required: true },
        { id: "rating", type: "rating", label: "How would you rate us?", config: { maxStars: 5 } },
        { id: "comments", type: "long_text", label: "Comments" },
      ],
    },
  ],
};

function App() {
  const handleSubmit = async (response: FormResponse) => {
    console.log(response);
  };

  return <FormEngineRenderer schema={schema} onSubmit={handleSubmit} />;
}

That's it. FormEngineRenderer creates its own engine, renders all fields, handles validation, and calls your onSubmit callback.

Styling

Import the pre-built stylesheet in your app entry point:

import "@squaredr/fieldcraft-react/styles.css";

Or if you use Tailwind CSS v4, import the stylesheet and let Tailwind scan the distributed component classes:

@import "@squaredr/fieldcraft-react/styles.css";

CSS Architecture

All field components use semantic .fc-* CSS classes (FieldCraft namespace) defined in the stylesheet. Visual styling flows through CSS custom properties set by FormEngineThemeProvider, so you can override any aspect with your own CSS:

/* Override in your own stylesheet */
.fc-option-active {
  border-color: var(--primary);
  background: var(--primary / 0.08);
}

Components

Core

| Component | Description | |-----------|-------------| | FormEngineRenderer | Full form renderer — pass a schema and get a working form | | SectionRenderer | Renders a single section of fields | | FieldRenderer | Renders a single field by type | | ProgressBar | Multi-section progress indicator | | NavigationButtons | Back/Next/Submit buttons | | ErrorSummary | Validation error list | | CompletionScreen | Post-submit confirmation |

Field Types (44)

Text: ShortTextField, LongTextField, EmailField, PhoneField, PhoneInternationalField, UrlField, LegalNameField

Numeric: NumberField, SliderField, RatingField, NpsField, LikertField, OpinionScaleField

Selection: SingleSelectField, MultiSelectField, DropdownField, BooleanField, CountrySelectField, RankingField

Date/Time: DateField, DateRangeField, TimeField, AppointmentField

Media: FileUploadField, SignatureField, ImageCaptureField

Advanced: AddressField, PaymentField, MatrixField, RepeaterField, CalculatedField, HiddenField, ScoringField

Structural: ConsentField, InfoBlockField

UI Primitives (shadcn/ui)

Re-exported for use in custom field components and pro packages:

Alert, Badge, Button, Calendar, Card, Checkbox, Collapsible, Input, Label, Popover, Progress, RadioGroup, Select, Separator, Slider, Switch, Table, Textarea, Toggle, ToggleGroup

Engine & Hooks

The react package re-exports createEngine, FormEngine, EngineOptions, and ValidationResult from @squaredr/fieldcraft-core for convenience — no need to import from core separately:

import { useFormEngine, createEngine } from "@squaredr/fieldcraft-react";
import type { FormEngine } from "@squaredr/fieldcraft-react";

useFormEngine

import { useFormEngine } from "@squaredr/fieldcraft-react";

function CustomForm({ schema }) {
  const engine = useFormEngine(schema);

  return (
    <div>
      <p>Current section: {engine.state.currentSectionId}</p>
      <button onClick={() => engine.setValue("name", "Alice")}>Set name</button>
      <button onClick={() => engine.nextSection()}>Next</button>
    </div>
  );
}

The hook returns a proxy that is resilient to React Strict Mode — it lazily re-creates the engine if it was destroyed during a Strict Mode remount cycle.

| Hook | Description | |------|-------------| | useFormEngine(schema, options?) | Creates and subscribes to a form engine | | useFieldValue(engine, questionId) | Reactive field value | | useFieldError(engine, questionId) | Reactive field error | | useSectionProgress(engine) | Section completion progress |

Theme Presets

import { FormEngineRenderer, darkPreset } from "@squaredr/fieldcraft-react";

<FormEngineRenderer schema={schema} onSubmit={handleSubmit} theme={darkPreset} />

Available presets: cleanPreset, modernPreset, darkPreset, highContrastPreset, clinicalPreset, playfulPreset

Custom Field Registry

Override or add field components:

import { createFieldRegistry, mergeRegistries, defaultRegistry } from "@squaredr/fieldcraft-react";

const customRegistry = mergeRegistries(defaultRegistry, {
  short_text: MyCustomTextField,
});

<FormEngineRenderer schema={schema} onSubmit={handleSubmit} components={customRegistry} />

Peer Dependencies

  • react ^18 || ^19
  • react-dom ^18 || ^19
  • @squaredr/fieldcraft-core ^1.3.2

Community

  • Discord — Get help, share projects, request features
  • Docs — Full documentation
  • GitHub — Source code and issues
  • Pro Tools — Visual FormBuilder, SchemaEditor, ResponseViewer, ThemeEditor

License

MIT