npm.io
0.13.1 • Published 7h ago

@metaobjectsdev/codegen-ts-react

Licence
Apache-2.0
Version
0.13.1
Deps
3
Size
37 kB
Vulns
0
Weekly
2.5K

@metaobjectsdev/codegen-ts-react

React codegen for MetaObjects. Provides the formFile() generator, which emits a per-entity <Entity>.form.tsx using react-hook-form and the useEntityForm / <CurrencyInput> helpers from @metaobjectsdev/react.

Install

pnpm add -D @metaobjectsdev/codegen-ts-react

Usage

In your metaobjects.config.ts:

import { defineConfig } from "@metaobjectsdev/cli";
import { formFile } from "@metaobjectsdev/codegen-ts-react";

export default defineConfig({
  generators: [formFile()],
});

formFile({ target }) routes the generated .form.tsx to a named output target (e.g. the browser app) — see @metaobjectsdev/cli README, "Multiple output targets". The form imports the entity module from wherever entityFile() is routed (relative when same target, the entity-module target's importBase when not).

Pairs with

License

Apache 2.0 — see LICENSE at the repo root.

Keywords