solmate-skills 1.0.0
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/AGENTS.md +90 -0
- package/README.md +42 -0
- package/bin/cli.js +85 -0
- package/design-md/README.md +34 -0
- package/design-md/SKILL.md +172 -0
- package/design-md/examples/DESIGN.md +154 -0
- package/dev-conventions/SKILL.md +305 -0
- package/enhance-prompt/README.md +34 -0
- package/enhance-prompt/SKILL.md +204 -0
- package/enhance-prompt/references/KEYWORDS.md +114 -0
- package/implementation-workflow/SKILL.md +131 -0
- package/init-skills.sh +41 -0
- package/manage-collaboration/SKILL.md +50 -0
- package/manage-docs/SKILL.md +389 -0
- package/manage-skills/SKILL.md +52 -0
- package/obsidian-sync/SKILL.md +44 -0
- package/old_AGENTS.md +124 -0
- package/package.json +31 -0
- package/react-components/README.md +36 -0
- package/react-components/SKILL.md +47 -0
- package/react-components/examples/gold-standard-card.tsx +80 -0
- package/react-components/package.json +16 -0
- package/react-components/resources/architecture-checklist.md +15 -0
- package/react-components/resources/component-template.tsx +37 -0
- package/react-components/resources/stitch-api-reference.md +14 -0
- package/react-components/resources/style-guide.json +27 -0
- package/react-components/scripts/fetch-stitch.sh +30 -0
- package/react-components/scripts/validate.js +68 -0
- package/remotion/README.md +105 -0
- package/remotion/SKILL.md +393 -0
- package/remotion/examples/WalkthroughComposition.tsx +78 -0
- package/remotion/examples/screens.json +56 -0
- package/remotion/resources/composition-checklist.md +124 -0
- package/remotion/resources/screen-slide-template.tsx +123 -0
- package/remotion/scripts/download-stitch-asset.sh +38 -0
- package/shadcn-ui/README.md +248 -0
- package/shadcn-ui/SKILL.md +326 -0
- package/shadcn-ui/examples/auth-layout.tsx +177 -0
- package/shadcn-ui/examples/data-table.tsx +313 -0
- package/shadcn-ui/examples/form-pattern.tsx +177 -0
- package/shadcn-ui/resources/component-catalog.md +481 -0
- package/shadcn-ui/resources/customization-guide.md +516 -0
- package/shadcn-ui/resources/migration-guide.md +463 -0
- package/shadcn-ui/resources/setup-guide.md +412 -0
- package/shadcn-ui/scripts/verify-setup.sh +134 -0
- package/stitch-loop/README.md +54 -0
- package/stitch-loop/SKILL.md +203 -0
- package/stitch-loop/examples/SITE.md +73 -0
- package/stitch-loop/examples/next-prompt.md +25 -0
- package/stitch-loop/resources/baton-schema.md +61 -0
- package/stitch-loop/resources/site-template.md +104 -0
- package/verify-docs/SKILL.md +34 -0
- package/verify-drizzle-schema/SKILL.md +44 -0
- package/verify-implementation/SKILL.md +39 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
// Example: Data Table with Sorting and Filtering
|
|
2
|
+
// Demonstrates: Table composition, TanStack Table integration, responsive design
|
|
3
|
+
|
|
4
|
+
"use client"
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ColumnDef,
|
|
8
|
+
ColumnFiltersState,
|
|
9
|
+
flexRender,
|
|
10
|
+
getCoreRowModel,
|
|
11
|
+
getFilteredRowModel,
|
|
12
|
+
getPaginationRowModel,
|
|
13
|
+
getSortedRowModel,
|
|
14
|
+
SortingState,
|
|
15
|
+
useReactTable,
|
|
16
|
+
} from "@tanstack/react-table"
|
|
17
|
+
import { ArrowUpDown, ChevronDown, MoreHorizontal } from "lucide-react"
|
|
18
|
+
import * as React from "react"
|
|
19
|
+
|
|
20
|
+
import { Button } from "@/components/ui/button"
|
|
21
|
+
import {
|
|
22
|
+
DropdownMenu,
|
|
23
|
+
DropdownMenuCheckboxItem,
|
|
24
|
+
DropdownMenuContent,
|
|
25
|
+
DropdownMenuItem,
|
|
26
|
+
DropdownMenuLabel,
|
|
27
|
+
DropdownMenuSeparator,
|
|
28
|
+
DropdownMenuTrigger,
|
|
29
|
+
} from "@/components/ui/dropdown-menu"
|
|
30
|
+
import { Input } from "@/components/ui/input"
|
|
31
|
+
import {
|
|
32
|
+
Table,
|
|
33
|
+
TableBody,
|
|
34
|
+
TableCell,
|
|
35
|
+
TableHead,
|
|
36
|
+
TableHeader,
|
|
37
|
+
TableRow,
|
|
38
|
+
} from "@/components/ui/table"
|
|
39
|
+
|
|
40
|
+
// Define data type
|
|
41
|
+
export type User = {
|
|
42
|
+
id: string
|
|
43
|
+
name: string
|
|
44
|
+
email: string
|
|
45
|
+
role: "admin" | "user" | "viewer"
|
|
46
|
+
status: "active" | "inactive"
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Sample data
|
|
50
|
+
const data: User[] = [
|
|
51
|
+
{
|
|
52
|
+
id: "1",
|
|
53
|
+
name: "Alice Johnson",
|
|
54
|
+
email: "alice@example.com",
|
|
55
|
+
role: "admin",
|
|
56
|
+
status: "active",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "2",
|
|
60
|
+
name: "Bob Smith",
|
|
61
|
+
email: "bob@example.com",
|
|
62
|
+
role: "user",
|
|
63
|
+
status: "active",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "3",
|
|
67
|
+
name: "Carol White",
|
|
68
|
+
email: "carol@example.com",
|
|
69
|
+
role: "viewer",
|
|
70
|
+
status: "inactive",
|
|
71
|
+
},
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
// Define columns
|
|
75
|
+
export const columns: ColumnDef<User>[] = [
|
|
76
|
+
{
|
|
77
|
+
accessorKey: "name",
|
|
78
|
+
header: ({ column }) => {
|
|
79
|
+
return (
|
|
80
|
+
<Button
|
|
81
|
+
variant="ghost"
|
|
82
|
+
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
|
|
83
|
+
>
|
|
84
|
+
Name
|
|
85
|
+
<ArrowUpDown className="ml-2 h-4 w-4" />
|
|
86
|
+
</Button>
|
|
87
|
+
)
|
|
88
|
+
},
|
|
89
|
+
cell: ({ row }) => <div className="capitalize">{row.getValue("name")}</div>,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
accessorKey: "email",
|
|
93
|
+
header: ({ column }) => {
|
|
94
|
+
return (
|
|
95
|
+
<Button
|
|
96
|
+
variant="ghost"
|
|
97
|
+
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
|
|
98
|
+
>
|
|
99
|
+
Email
|
|
100
|
+
<ArrowUpDown className="ml-2 h-4 w-4" />
|
|
101
|
+
</Button>
|
|
102
|
+
)
|
|
103
|
+
},
|
|
104
|
+
cell: ({ row }) => <div className="lowercase">{row.getValue("email")}</div>,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
accessorKey: "role",
|
|
108
|
+
header: "Role",
|
|
109
|
+
cell: ({ row }) => (
|
|
110
|
+
<div className="capitalize">{row.getValue("role")}</div>
|
|
111
|
+
),
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
accessorKey: "status",
|
|
115
|
+
header: "Status",
|
|
116
|
+
cell: ({ row }) => (
|
|
117
|
+
<div className="capitalize">{row.getValue("status")}</div>
|
|
118
|
+
),
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: "actions",
|
|
122
|
+
enableHiding: false,
|
|
123
|
+
cell: ({ row }) => {
|
|
124
|
+
const user = row.original
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<DropdownMenu>
|
|
128
|
+
<DropdownMenuTrigger asChild>
|
|
129
|
+
<Button variant="ghost" className="h-8 w-8 p-0">
|
|
130
|
+
<span className="sr-only">Open menu</span>
|
|
131
|
+
<MoreHorizontal className="h-4 w-4" />
|
|
132
|
+
</Button>
|
|
133
|
+
</DropdownMenuTrigger>
|
|
134
|
+
<DropdownMenuContent align="end">
|
|
135
|
+
<DropdownMenuLabel>Actions</DropdownMenuLabel>
|
|
136
|
+
<DropdownMenuItem
|
|
137
|
+
onClick={() => navigator.clipboard.writeText(user.id)}
|
|
138
|
+
>
|
|
139
|
+
Copy user ID
|
|
140
|
+
</DropdownMenuItem>
|
|
141
|
+
<DropdownMenuSeparator />
|
|
142
|
+
<DropdownMenuItem>View user</DropdownMenuItem>
|
|
143
|
+
<DropdownMenuItem>Edit user</DropdownMenuItem>
|
|
144
|
+
</DropdownMenuContent>
|
|
145
|
+
</DropdownMenu>
|
|
146
|
+
)
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
]
|
|
150
|
+
|
|
151
|
+
export function DataTableExample() {
|
|
152
|
+
const [sorting, setSorting] = React.useState<SortingState>([])
|
|
153
|
+
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>([])
|
|
154
|
+
const [columnVisibility, setColumnVisibility] = React.useState({})
|
|
155
|
+
const [rowSelection, setRowSelection] = React.useState({})
|
|
156
|
+
|
|
157
|
+
const table = useReactTable({
|
|
158
|
+
data,
|
|
159
|
+
columns,
|
|
160
|
+
onSortingChange: setSorting,
|
|
161
|
+
onColumnFiltersChange: setColumnFilters,
|
|
162
|
+
getCoreRowModel: getCoreRowModel(),
|
|
163
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
164
|
+
getSortedRowModel: getSortedRowModel(),
|
|
165
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
166
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
167
|
+
onRowSelectionChange: setRowSelection,
|
|
168
|
+
state: {
|
|
169
|
+
sorting,
|
|
170
|
+
columnFilters,
|
|
171
|
+
columnVisibility,
|
|
172
|
+
rowSelection,
|
|
173
|
+
},
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<div className="w-full">
|
|
178
|
+
<div className="flex items-center py-4">
|
|
179
|
+
<Input
|
|
180
|
+
placeholder="Filter names..."
|
|
181
|
+
value={(table.getColumn("name")?.getFilterValue() as string) ?? ""}
|
|
182
|
+
onChange={(event) =>
|
|
183
|
+
table.getColumn("name")?.setFilterValue(event.target.value)
|
|
184
|
+
}
|
|
185
|
+
className="max-w-sm"
|
|
186
|
+
/>
|
|
187
|
+
<DropdownMenu>
|
|
188
|
+
<DropdownMenuTrigger asChild>
|
|
189
|
+
<Button variant="outline" className="ml-auto">
|
|
190
|
+
Columns <ChevronDown className="ml-2 h-4 w-4" />
|
|
191
|
+
</Button>
|
|
192
|
+
</DropdownMenuTrigger>
|
|
193
|
+
<DropdownMenuContent align="end">
|
|
194
|
+
{table
|
|
195
|
+
.getAllColumns()
|
|
196
|
+
.filter((column) => column.getCanHide())
|
|
197
|
+
.map((column) => {
|
|
198
|
+
return (
|
|
199
|
+
<DropdownMenuCheckboxItem
|
|
200
|
+
key={column.id}
|
|
201
|
+
className="capitalize"
|
|
202
|
+
checked={column.getIsVisible()}
|
|
203
|
+
onCheckedChange={(value) =>
|
|
204
|
+
column.toggleVisibility(!!value)
|
|
205
|
+
}
|
|
206
|
+
>
|
|
207
|
+
{column.id}
|
|
208
|
+
</DropdownMenuCheckboxItem>
|
|
209
|
+
)
|
|
210
|
+
})}
|
|
211
|
+
</DropdownMenuContent>
|
|
212
|
+
</DropdownMenu>
|
|
213
|
+
</div>
|
|
214
|
+
<div className="rounded-md border">
|
|
215
|
+
<Table>
|
|
216
|
+
<TableHeader>
|
|
217
|
+
{table.getHeaderGroups().map((headerGroup) => (
|
|
218
|
+
<TableRow key={headerGroup.id}>
|
|
219
|
+
{headerGroup.headers.map((header) => {
|
|
220
|
+
return (
|
|
221
|
+
<TableHead key={header.id}>
|
|
222
|
+
{header.isPlaceholder
|
|
223
|
+
? null
|
|
224
|
+
: flexRender(
|
|
225
|
+
header.column.columnDef.header,
|
|
226
|
+
header.getContext()
|
|
227
|
+
)}
|
|
228
|
+
</TableHead>
|
|
229
|
+
)
|
|
230
|
+
})}
|
|
231
|
+
</TableRow>
|
|
232
|
+
))}
|
|
233
|
+
</TableHeader>
|
|
234
|
+
<TableBody>
|
|
235
|
+
{table.getRowModel().rows?.length ? (
|
|
236
|
+
table.getRowModel().rows.map((row) => (
|
|
237
|
+
<TableRow
|
|
238
|
+
key={row.id}
|
|
239
|
+
data-state={row.getIsSelected() && "selected"}
|
|
240
|
+
>
|
|
241
|
+
{row.getVisibleCells().map((cell) => (
|
|
242
|
+
<TableCell key={cell.id}>
|
|
243
|
+
{flexRender(
|
|
244
|
+
cell.column.columnDef.cell,
|
|
245
|
+
cell.getContext()
|
|
246
|
+
)}
|
|
247
|
+
</TableCell>
|
|
248
|
+
))}
|
|
249
|
+
</TableRow>
|
|
250
|
+
))
|
|
251
|
+
) : (
|
|
252
|
+
<TableRow>
|
|
253
|
+
<TableCell
|
|
254
|
+
colSpan={columns.length}
|
|
255
|
+
className="h-24 text-center"
|
|
256
|
+
>
|
|
257
|
+
No results.
|
|
258
|
+
</TableCell>
|
|
259
|
+
</TableRow>
|
|
260
|
+
)}
|
|
261
|
+
</TableBody>
|
|
262
|
+
</Table>
|
|
263
|
+
</div>
|
|
264
|
+
<div className="flex items-center justify-end space-x-2 py-4">
|
|
265
|
+
<div className="flex-1 text-sm text-muted-foreground">
|
|
266
|
+
{table.getFilteredSelectedRowModel().rows.length} of{" "}
|
|
267
|
+
{table.getFilteredRowModel().rows.length} row(s) selected.
|
|
268
|
+
</div>
|
|
269
|
+
<div className="space-x-2">
|
|
270
|
+
<Button
|
|
271
|
+
variant="outline"
|
|
272
|
+
size="sm"
|
|
273
|
+
onClick={() => table.previousPage()}
|
|
274
|
+
disabled={!table.getCanPreviousPage()}
|
|
275
|
+
>
|
|
276
|
+
Previous
|
|
277
|
+
</Button>
|
|
278
|
+
<Button
|
|
279
|
+
variant="outline"
|
|
280
|
+
size="sm"
|
|
281
|
+
onClick={() => table.nextPage()}
|
|
282
|
+
disabled={!table.getCanNextPage()}
|
|
283
|
+
>
|
|
284
|
+
Next
|
|
285
|
+
</Button>
|
|
286
|
+
</div>
|
|
287
|
+
</div>
|
|
288
|
+
</div>
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Key Patterns Demonstrated:
|
|
294
|
+
*
|
|
295
|
+
* 1. TanStack Table Integration: Using @tanstack/react-table with shadcn/ui
|
|
296
|
+
* 2. Sorting: Click headers to sort ascending/descending
|
|
297
|
+
* 3. Filtering: Text input to filter table data
|
|
298
|
+
* 4. Column Visibility: Toggle columns via dropdown menu
|
|
299
|
+
* 5. Pagination: Built-in pagination controls
|
|
300
|
+
* 6. Row Actions: Dropdown menu per row for context actions
|
|
301
|
+
* 7. Responsive Design: Table adapts to different screen sizes
|
|
302
|
+
*
|
|
303
|
+
* Required Dependencies:
|
|
304
|
+
* - @tanstack/react-table
|
|
305
|
+
* - lucide-react
|
|
306
|
+
*
|
|
307
|
+
* Installation:
|
|
308
|
+
* npx shadcn@latest add table
|
|
309
|
+
* npx shadcn@latest add button
|
|
310
|
+
* npx shadcn@latest add input
|
|
311
|
+
* npx shadcn@latest add dropdown-menu
|
|
312
|
+
* npm install @tanstack/react-table lucide-react
|
|
313
|
+
*/
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// Example: Form Pattern with shadcn/ui components
|
|
2
|
+
// Demonstrates: Form building, validation, and composition
|
|
3
|
+
|
|
4
|
+
"use client"
|
|
5
|
+
|
|
6
|
+
import { Button } from "@/components/ui/button"
|
|
7
|
+
import {
|
|
8
|
+
Form,
|
|
9
|
+
FormControl,
|
|
10
|
+
FormDescription,
|
|
11
|
+
FormField,
|
|
12
|
+
FormItem,
|
|
13
|
+
FormLabel,
|
|
14
|
+
FormMessage,
|
|
15
|
+
} from "@/components/ui/form"
|
|
16
|
+
import { Input } from "@/components/ui/input"
|
|
17
|
+
import {
|
|
18
|
+
Select,
|
|
19
|
+
SelectContent,
|
|
20
|
+
SelectItem,
|
|
21
|
+
SelectTrigger,
|
|
22
|
+
SelectValue,
|
|
23
|
+
} from "@/components/ui/select"
|
|
24
|
+
import { Textarea } from "@/components/ui/textarea"
|
|
25
|
+
import { toast } from "@/components/ui/use-toast"
|
|
26
|
+
import { zodResolver } from "@hookform/resolvers/zod"
|
|
27
|
+
import { useForm } from "react-hook-form"
|
|
28
|
+
import * as z from "zod"
|
|
29
|
+
|
|
30
|
+
// Define form schema with zod
|
|
31
|
+
const formSchema = z.object({
|
|
32
|
+
username: z.string().min(2, {
|
|
33
|
+
message: "Username must be at least 2 characters.",
|
|
34
|
+
}),
|
|
35
|
+
email: z.string().email({
|
|
36
|
+
message: "Please enter a valid email address.",
|
|
37
|
+
}),
|
|
38
|
+
role: z.enum(["admin", "user", "viewer"], {
|
|
39
|
+
required_error: "Please select a role.",
|
|
40
|
+
}),
|
|
41
|
+
bio: z.string().max(160, {
|
|
42
|
+
message: "Bio must not be longer than 160 characters.",
|
|
43
|
+
}).optional(),
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
type FormValues = z.infer<typeof formSchema>
|
|
47
|
+
|
|
48
|
+
export function UserProfileForm() {
|
|
49
|
+
// Initialize form with react-hook-form and zod validation
|
|
50
|
+
const form = useForm<FormValues>({
|
|
51
|
+
resolver: zodResolver(formSchema),
|
|
52
|
+
defaultValues: {
|
|
53
|
+
username: "",
|
|
54
|
+
email: "",
|
|
55
|
+
bio: "",
|
|
56
|
+
},
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
// Handle form submission
|
|
60
|
+
function onSubmit(values: FormValues) {
|
|
61
|
+
// In a real app, send to API
|
|
62
|
+
console.log(values)
|
|
63
|
+
|
|
64
|
+
toast({
|
|
65
|
+
title: "Profile updated",
|
|
66
|
+
description: "Your profile has been successfully updated.",
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<Form {...form}>
|
|
72
|
+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
|
73
|
+
<FormField
|
|
74
|
+
control={form.control}
|
|
75
|
+
name="username"
|
|
76
|
+
render={({ field }) => (
|
|
77
|
+
<FormItem>
|
|
78
|
+
<FormLabel>Username</FormLabel>
|
|
79
|
+
<FormControl>
|
|
80
|
+
<Input placeholder="johndoe" {...field} />
|
|
81
|
+
</FormControl>
|
|
82
|
+
<FormDescription>
|
|
83
|
+
This is your public display name.
|
|
84
|
+
</FormDescription>
|
|
85
|
+
<FormMessage />
|
|
86
|
+
</FormItem>
|
|
87
|
+
)}
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
<FormField
|
|
91
|
+
control={form.control}
|
|
92
|
+
name="email"
|
|
93
|
+
render={({ field }) => (
|
|
94
|
+
<FormItem>
|
|
95
|
+
<FormLabel>Email</FormLabel>
|
|
96
|
+
<FormControl>
|
|
97
|
+
<Input type="email" placeholder="john@example.com" {...field} />
|
|
98
|
+
</FormControl>
|
|
99
|
+
<FormMessage />
|
|
100
|
+
</FormItem>
|
|
101
|
+
)}
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
<FormField
|
|
105
|
+
control={form.control}
|
|
106
|
+
name="role"
|
|
107
|
+
render={({ field }) => (
|
|
108
|
+
<FormItem>
|
|
109
|
+
<FormLabel>Role</FormLabel>
|
|
110
|
+
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
|
111
|
+
<FormControl>
|
|
112
|
+
<SelectTrigger>
|
|
113
|
+
<SelectValue placeholder="Select a role" />
|
|
114
|
+
</SelectTrigger>
|
|
115
|
+
</FormControl>
|
|
116
|
+
<SelectContent>
|
|
117
|
+
<SelectItem value="admin">Admin</SelectItem>
|
|
118
|
+
<SelectItem value="user">User</SelectItem>
|
|
119
|
+
<SelectItem value="viewer">Viewer</SelectItem>
|
|
120
|
+
</SelectContent>
|
|
121
|
+
</Select>
|
|
122
|
+
<FormDescription>
|
|
123
|
+
Your role determines your access level.
|
|
124
|
+
</FormDescription>
|
|
125
|
+
<FormMessage />
|
|
126
|
+
</FormItem>
|
|
127
|
+
)}
|
|
128
|
+
/>
|
|
129
|
+
|
|
130
|
+
<FormField
|
|
131
|
+
control={form.control}
|
|
132
|
+
name="bio"
|
|
133
|
+
render={({ field }) => (
|
|
134
|
+
<FormItem>
|
|
135
|
+
<FormLabel>Bio</FormLabel>
|
|
136
|
+
<FormControl>
|
|
137
|
+
<Textarea
|
|
138
|
+
placeholder="Tell us about yourself"
|
|
139
|
+
className="resize-none"
|
|
140
|
+
{...field}
|
|
141
|
+
/>
|
|
142
|
+
</FormControl>
|
|
143
|
+
<FormDescription>
|
|
144
|
+
Optional. Maximum 160 characters.
|
|
145
|
+
</FormDescription>
|
|
146
|
+
<FormMessage />
|
|
147
|
+
</FormItem>
|
|
148
|
+
)}
|
|
149
|
+
/>
|
|
150
|
+
|
|
151
|
+
<Button type="submit">Update profile</Button>
|
|
152
|
+
</form>
|
|
153
|
+
</Form>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Key Patterns Demonstrated:
|
|
159
|
+
*
|
|
160
|
+
* 1. Form Composition: Using shadcn/ui's Form components with react-hook-form
|
|
161
|
+
* 2. Validation: Zod schema for type-safe validation
|
|
162
|
+
* 3. Error Handling: Automatic error messages via FormMessage
|
|
163
|
+
* 4. Accessibility: All fields properly labeled with descriptions
|
|
164
|
+
* 5. Type Safety: TypeScript types inferred from Zod schema
|
|
165
|
+
*
|
|
166
|
+
* Required Dependencies:
|
|
167
|
+
* - react-hook-form
|
|
168
|
+
* - @hookform/resolvers
|
|
169
|
+
* - zod
|
|
170
|
+
*
|
|
171
|
+
* Installation:
|
|
172
|
+
* npx shadcn@latest add form
|
|
173
|
+
* npx shadcn@latest add input
|
|
174
|
+
* npx shadcn@latest add select
|
|
175
|
+
* npx shadcn@latest add textarea
|
|
176
|
+
* npx shadcn@latest add button
|
|
177
|
+
*/
|