@formdef/core 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
|
+
<a href="https://formdef.mauricereim.de"><img src="https://formdef.mauricereim.de/brand/banner-light.png" alt="formdef. Describe a form once. Render it as a React component." width="100%" /></a>
|
|
2
|
+
|
|
1
3
|
# @formdef/core
|
|
2
4
|
|
|
3
5
|
Describe a form once as a typed object, render it as a React component — with the compiler
|
|
4
|
-
checking that every widget fits the value it receives.
|
|
6
|
+
checking that every widget fits the value it receives. Built on
|
|
7
|
+
[TanStack Form](https://tanstack.com/form).
|
|
8
|
+
|
|
9
|
+
`createForm` comes from the registry that names your widgets, which
|
|
10
|
+
[Getting started](https://formdef.mauricereim.de/getting-started) sets up:
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
export const SignIn = createForm({
|
|
14
|
+
schema: z.object({ email: z.email(), remember: z.boolean() }),
|
|
15
|
+
defaultValues: { email: '', remember: false },
|
|
16
|
+
fields: {
|
|
17
|
+
email: { widget: 'text', props: { label: 'Email' } },
|
|
18
|
+
remember: { widget: 'checkbox', props: { label: 'Remember me' } },
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
5
24
|
|
|
6
|
-
|
|
7
|
-
|
|
25
|
+
```bash
|
|
26
|
+
npm install @formdef/core @tanstack/react-form zod
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Zod stands for any schema library that implements [Standard Schema](https://standardschema.dev).
|
|
30
|
+
The widgets for shadcn/ui come from formdef's shadcn registry; the
|
|
31
|
+
[installation guide](https://formdef.mauricereim.de/installation) shows how to add it.
|
|
8
32
|
|
|
9
33
|
## Requirements
|
|
10
34
|
|
|
@@ -13,6 +37,11 @@ Built on [TanStack Form](https://tanstack.com/form). Not released yet; see the
|
|
|
13
37
|
- TypeScript 5.4 or later
|
|
14
38
|
- Node 22 or later
|
|
15
39
|
|
|
40
|
+
## Documentation
|
|
41
|
+
|
|
42
|
+
[formdef.mauricereim.de](https://formdef.mauricereim.de), starting with
|
|
43
|
+
[Getting started](https://formdef.mauricereim.de/getting-started).
|
|
44
|
+
|
|
16
45
|
## License
|
|
17
46
|
|
|
18
47
|
[MIT](https://github.com/maurice-rm/formdef/blob/main/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formdef/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Describe a form once as a typed object, render it as a React component, with the compiler checking that every widget fits its value. Built on TanStack Form.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"author": "Maurice Reim",
|
|
17
|
-
"homepage": "https://
|
|
17
|
+
"homepage": "https://formdef.mauricereim.de",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
20
|
"url": "git+https://github.com/maurice-rm/formdef.git",
|