solid-hook-form 1.1.0 → 1.1.2

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.
Files changed (2) hide show
  1. package/README.md +47 -33
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,39 +1,53 @@
1
- # solid-hook-form
1
+ # Solid Hook Form
2
2
 
3
- ```tsx
4
- import { useForm } from "solid-hook-form";
3
+ ### Playground
4
+
5
+ [<img width="1171" alt="Screenshot 2025-04-05 at 15 01 47" src="https://github.com/user-attachments/assets/072eb398-85fa-4240-b305-dcbbe9c0a9c8" />](https://solid-hook-form.vercel.app/)
6
+
7
+ ### Install
5
8
 
6
- const { errors, isValid, register, onSubmit } = useForm({
7
- defaultValues: {
8
- date: new Date().toISOString().split("T")[0],
9
- email: "",
10
- password: "",
11
- age: 0,
12
- remember: false,
13
- },
14
- });
9
+ ```sh
10
+ npm install solid-hook-form
15
11
  ```
16
12
 
13
+ ### Quickstart
14
+
17
15
  ```tsx
18
- <form onSubmit={onSubmit(handleSubmit)}>
19
- <input type="date" {...register("date", { required: "Required" })} />;
20
- <input
21
- {...register("email", {
22
- required: "Required",
23
- pattern: {
24
- value: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
25
- message: "Invalid email",
26
- },
27
- })}
28
- />
29
- <input
30
- {...register("password", {
31
- required: "Required",
32
- minLength: { value: 8, message: "Min 8" },
33
- })}
34
- />
35
- <input type="number" {...register("age", { min: 18, max: 100 })} />
36
- <input type="checkbox" {...register("remember", { required: "Required" })} />
37
- <button type="submit">Submit</button>
38
- </form>
16
+ import { useForm } from "solid-hook-form";
17
+
18
+ const Form = () => {
19
+ const { errors, isValid, register, onSubmit } = useForm({
20
+ defaultValues: {
21
+ date: new Date().toISOString().split("T")[0],
22
+ email: "",
23
+ password: "",
24
+ age: 0,
25
+ remember: false,
26
+ },
27
+ });
28
+
29
+ return (
30
+ <form onSubmit={onSubmit(handleSubmit)}>
31
+ <input type="date" {...register("date", { required: "Required" })} />;
32
+ <input
33
+ {...register("email", {
34
+ required: "Required",
35
+ pattern: {
36
+ value: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
37
+ message: "Invalid email",
38
+ },
39
+ })}
40
+ />
41
+ <input
42
+ {...register("password", {
43
+ required: "Required",
44
+ minLength: { value: 8, message: "Min 8" },
45
+ })}
46
+ />
47
+ <input type="number" {...register("age", { min: 18, max: 100 })} />
48
+ <input type="checkbox" {...register("remember", { required: "Required" })} />
49
+ <button type="submit">Submit</button>
50
+ </form>
51
+ );
52
+ };
39
53
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-hook-form",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "main": "./dist/main.umd.cjs",
6
6
  "module": "./dist/main.js",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "author": "thorn_pear",
36
36
  "license": "ISC",
37
- "description": "Performant, flexible and extensible forms library for Solid",
37
+ "description": "Performant, flexible and extensible forms with easy to use validation",
38
38
  "repository": {
39
39
  "type": "git",
40
40
  "url": "https://github.com/tatsmaki/solid-hook-form.git"