StackForm
Getting Started

Installation

Install StackForm in your project

What is StackForm?

StackForm is a headless, slot-based form component library for React that bridges shadcn/ui with React Hook Form, TanStack Form, and plain React state. It gives you a unified field API with built-in error display, loading states, character counts, and async selects — with zero per-field boilerplate.


Prerequisites


Install via npm

Install the packages for your chosen adapter:

# React Hook Form
npm install @stackform/core @stackform/ui @stackform/rhf react-hook-form

# TanStack Form
npm install @stackform/core @stackform/ui @stackform/tanstack @tanstack/react-form

# Native (no form library)
npm install @stackform/core @stackform/ui @stackform/native

The CLI scaffolds your project and ejects slot components into your source tree so you have full control.

# Initialise StackForm in your project
npx @stackform/cli init

# Add individual field components
npx @stackform/cli add text-field

Two customisation paths

Path A — npm install

Use @stackform/ui defaults as-is. Customise appearance via classNames prop on any field or StackFormProvider. No file ejection required.

Path B — CLI add

Eject individual slot components into your project. Modify the source directly for complete control over markup, styles, and behaviour.

Both paths use the same field API. You can mix them.