shadcn-ui-react 0.0.3 → 0.0.5

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 CHANGED
@@ -17,6 +17,12 @@ yarn add shadcn-ui-react
17
17
 
18
18
  ## Usage
19
19
 
20
+ Import `style.css` in the App root:
21
+
22
+ ```tsx
23
+ import 'shadcn-ui-react/dist/index.css';
24
+ ```
25
+
20
26
  Then use the components:
21
27
 
22
28
  ```tsx
@@ -27,13 +33,79 @@ export default function MyComponent() {
27
33
  }
28
34
  ```
29
35
 
30
- Use [lucide icons](https://lucide.dev/icons/):
36
+ ```tsx
37
+ import { Card } from 'shadcn-ui-react'
31
38
 
39
+ export default function MyComponent() {
40
+ return <Card/>
41
+ }
42
+ ```
43
+
44
+ ## Example
32
45
  ```tsx
46
+ import { zodResolver } from '@hookform/resolvers/zod';
47
+ import { useForm } from 'react-hook-form';
48
+ import {
49
+ Button,
50
+ Form,
51
+ FormControl,
52
+ FormField,
53
+ FormItem,
54
+ FormLabel,
55
+ FormMessage,
56
+ Input
57
+ } from 'shadcn-ui-react';
58
+ import * as z from 'zod';
33
59
 
34
- import { Icons } from 'shadcn-ui-react'
60
+ const formSchema = z.object({
61
+ email: z.string().email({ message: 'Enter a valid email address' }),
62
+ password: z
63
+ .string()
64
+ .min(8, { message: 'Password must be at least 8 characters' })
65
+ });
35
66
 
36
- export default function MyComponent() {
37
- return <Icons.Add />
67
+ type UserFormValue = z.infer<typeof formSchema>;
68
+
69
+ export default function UserAuthForm() {
70
+ const defaultValues = {
71
+ email: 'demo@domain.com'
72
+ };
73
+ const form = useForm<UserFormValue>({
74
+ resolver: zodResolver(formSchema),
75
+ defaultValues
76
+ });
77
+
78
+ const onSubmit = async (data: UserFormValue) => {};
79
+
80
+ return (
81
+ <Form {...form}>
82
+ <form
83
+ onSubmit={form.handleSubmit(onSubmit)}
84
+ className="w-full space-y-2"
85
+ >
86
+ <FormField
87
+ control={form.control}
88
+ name="email"
89
+ render={({ field }) => (
90
+ <FormItem>
91
+ <FormLabel>Email</FormLabel>
92
+ <FormControl>
93
+ <Input
94
+ id="email"
95
+ type="email"
96
+ placeholder="Ingrese su email"
97
+ {...field}
98
+ />
99
+ </FormControl>
100
+ <FormMessage />
101
+ </FormItem>
102
+ )}
103
+ />
104
+ <Button className="ml-auto w-full" type="submit">
105
+ Log In
106
+ </Button>
107
+ </form>
108
+ </Form>
109
+ );
38
110
  }
39
111
  ```