Core Concepts
What is Prism?
The problem Prism solves and the developer experience it delivers.
The problem
Teams building internal tools, admin panels, and data-heavy applications in React repeatedly write the same glue code:
- A Zod schema, a React Hook Form
useFormcall, aControllerper field, and a UI component per field type, repeated for every form in the app, with no shared contract between a field's declared type and the component rendering it. - Ad hoc "field registries" (large
switchstatements or lookup objects) that map a field "type" string to a component, with no compile-time guarantee that the component receives the props it expects, or that its value type matches the form field's value type. - Copy-pasted provider/context setup, each app slightly different, none interoperable.
The Prism developer experience
With Prism, a consumer:
- Installs a small set of Prism-owned, Tailwind-based UI primitives into their own repo via a CLI, and edits them freely afterward, see CLI.
- Wraps those primitives (or any other UI library) into field components that accept Prism's normalized field-binding contract, see Custom Fields.
- Registers those field components in a typed registry, see Registry System.
- Builds a form configuration against that registry and gets full TypeScript inference, rejecting mismatched props, mismatched value types, and invalid field paths at compile time instead of at runtime, see Forms.
- Reaches into the underlying
react-hook-formAPI at any time, for anything Prism's configuration surface doesn't cover, see React Hook Form Integration.
Core principles
- Configuration-driven developer experience. A form is declared as data, not assembled by hand field by field.
- Strong TypeScript inference. A field's configuration is checked against its component's
actual value type, not just that a
typestring exists. - Bring Your Own Library (BYOL). Prism integrates libraries you already chose, it doesn't replace them.
- No black-box abstractions. Every layer preserves direct access to the library underneath it.
- Preserve access to underlying library APIs.
usePrismFormreturns the complete, unmodified React Hook Form object. - Modular packages and tree-shaking. Six focused packages, not one monolith.
- No unnecessary runtime dependencies.
@prismrepo/corehas zero. - No hidden global mutable registries.
defineRegistryis a plain function, not a module-level side effect. - Provider isolation. Multiple independent
PrismProviders never leak configuration into one another. - Static configuration stays separate from mutable runtime state. A
FormDefinitionis immutable; form state lives in React Hook Form. - Consumer customization is a first-class capability. Installed primitives are yours to edit, not a package to fork.
- Prefer integrating mature libraries over reinventing them. React Hook Form and Zod do the hard work; Prism connects them.
- Accessibility is a requirement, not a future enhancement. Correct ARIA wiring, keyboard operability, and visible focus state ship in every Prism-authored primitive.
- Architecture decisions are documented and tested, see Architecture Overview.