Quick Start
Get a working form rendering in under 5 minutes.
1. Install
- npm
- Yarn
- pnpm
- Bun
npm install @fogpipe/forma-core @fogpipe/forma-react
yarn add @fogpipe/forma-core @fogpipe/forma-react
pnpm add @fogpipe/forma-core @fogpipe/forma-react
bun add @fogpipe/forma-core @fogpipe/forma-react
2. Render a Form
Forma React ships with default components — pre-built, styled, accessible field components that cover all 18 field types. Import them and render:
import { DefaultFormRenderer } from "@fogpipe/forma-react/defaults";
import "@fogpipe/forma-react/defaults/styles.css";
import type { Forma } from "@fogpipe/forma-core";
const contactForm: Forma = {
version: "1.0",
meta: { id: "contact-form", title: "Contact Us" },
schema: {
type: "object",
properties: {
name: { type: "string" },
email: { type: "string", format: "email" },
subscribe: { type: "boolean" },
},
required: ["name", "email"],
},
fields: {
name: { type: "text", label: "Your Name", placeholder: "Enter your name" },
email: {
type: "email",
label: "Email Address",
placeholder: "you@example.com",
},
subscribe: { type: "boolean", label: "Subscribe to newsletter" },
},
fieldOrder: ["name", "email", "subscribe"],
};
function ContactPage() {
return (
<DefaultFormRenderer
spec={contactForm}
onSubmit={(data) => console.log("Submitted:", data)}
/>
);
}
That's it. You get a styled form with validation, error display, and a submit button.
3. Customize the Theme
Override CSS variables to match your brand — no component code needed:
:root {
--forma-color-primary: #7c3aed;
--forma-radius: 12px;
--forma-font-family: "Inter", sans-serif;
}
See Default Components — Theming for the full variable reference.
4. Add Wizard Navigation
For multi-page forms, add wizardLayout:
<DefaultFormRenderer
spec={multiPageSpec}
onSubmit={handleSubmit}
wizardLayout
/>
How It Works
Forma React is headless — it separates form logic from UI. Under the hood:
- Forma spec defines the form structure, validation rules, and conditional logic
useFormahook manages all state — values, errors, visibility, computed fields, wizard navigation- Components render the UI for each field type
FormRendererwires everything together
The default components are one implementation of step 3. When you need full control over your UI — custom design systems, Tailwind, Radix, shadcn — you can replace any or all components:
import { FormRenderer } from "@fogpipe/forma-react";
import { defaultComponentMap } from "@fogpipe/forma-react/defaults";
// Replace just select, keep defaults for everything else
const components = { ...defaultComponentMap, select: MyFancySelect };
<FormRenderer spec={spec} components={components} onSubmit={handleSubmit} />;
Or build an entirely custom component map from scratch — see Component Mapping.
Next Steps
- Default Components — Full reference: all CSS variables, component details, wizard, gotcha prevention
- End-to-End Integration — Fetch from API, render, and submit
- Component Mapping — Build custom components for full UI control
- Styling Guide — Tailwind, CSS Modules, and styling patterns
- Wizard Forms — Multi-page form configuration