Renderers, themes, and styling
The starter keeps package rendering contracts separate from application presentation. Import
form0-react/index.css once, then layer application-specific choices on top.
Field renderers
Application renderer overrides live in src/field-renderers. To add one:
- Create the React component.
- Add it to
src/field-renderers/resolver.jsunder a stable identifier. - Map the form0 field type to that identifier in
form0.config.js.
Code
The included date renderer demonstrates composing form0 field props with shadcn/ui primitives. Review the custom renderer contract before creating additional overrides.
Themes
Set theme.mode to light, dark, or system. To replace the package theme, create a Vanilla
Extract theme under src/themes and set theme.customTheme to its import path.
The custom theme must implement the complete form0-react theme contract. Use
src/themes/custom-example.css.js as the starting point and see
Themes and styling for the contract.
Application CSS
Use these layers for different responsibilities:
src/index.cssfor Tailwind, shadcn tokens, and global application styles;src/App.cssfor application layout;src/styles/form0-overrides.cssfor application-owned form classes; and- Vanilla Extract themes for package renderer tokens.
Prefer renderer registration and theme contracts over editing code inside installed form0 packages.