skillfullstack 0.0.0-stage → 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.
Files changed (775) hide show
  1. package/.skillsRegistry/catalog.json +231 -0
  2. package/AGENTS.md +89 -0
  3. package/README.md +210 -2
  4. package/bin/index.js +508 -0
  5. package/package.json +57 -4
  6. package/skills/backend/apiEngineering/SKILL.md +102 -0
  7. package/skills/backend/apiEngineering/evals/evalApiEngineering.py +81 -0
  8. package/skills/backend/apiEngineering/evals/fixtures/invalid/sampleInvalidOpenApi.json +40 -0
  9. package/skills/backend/apiEngineering/evals/fixtures/valid/sampleValidOpenApi.json +47 -0
  10. package/skills/backend/apiEngineering/policies/compatibility.md +42 -0
  11. package/skills/backend/apiEngineering/policies/mandatory.md +48 -0
  12. package/skills/backend/apiEngineering/policies/performance.md +39 -0
  13. package/skills/backend/apiEngineering/policies/security.md +36 -0
  14. package/skills/backend/apiEngineering/references/apiObservability.md +39 -0
  15. package/skills/backend/apiEngineering/references/apiReference.md +3 -0
  16. package/skills/backend/apiEngineering/references/apiSecurityOwasp.md +47 -0
  17. package/skills/backend/apiEngineering/references/contractCompatibility.md +26 -0
  18. package/skills/backend/apiEngineering/references/databaseTransactions.md +40 -0
  19. package/skills/backend/apiEngineering/references/distributedReliability.md +26 -0
  20. package/skills/backend/apiEngineering/references/multiTenancy.md +27 -0
  21. package/skills/backend/apiEngineering/references/openApi32Standards.md +58 -0
  22. package/skills/backend/apiEngineering/references/paginationVersioning.md +57 -0
  23. package/skills/backend/apiEngineering/references/responseStandards.md +94 -0
  24. package/skills/backend/apiEngineering/scripts/auditApiContract.py +123 -0
  25. package/skills/backend/apiEngineering/scripts/checkBreakingChanges.py +77 -0
  26. package/skills/backend/apiEngineering/scripts/generateResponseEnvelope.py +88 -0
  27. package/skills/backend/apiEngineering/templates/apiChecklist.md +27 -0
  28. package/skills/backend/apiEngineering/templates/openapi.yaml +125 -0
  29. package/skills/backend/apiEngineering/templates/problemDetails.json +44 -0
  30. package/skills/backend/databaseArchitecture/SKILL.md +118 -0
  31. package/skills/backend/databaseArchitecture/evals/evalDatabaseArchitecture.py +85 -0
  32. package/skills/backend/databaseArchitecture/evals/fixtures/dangerousMigration.sql +4 -0
  33. package/skills/backend/databaseArchitecture/evals/fixtures/invalidSchema.sql +23 -0
  34. package/skills/backend/databaseArchitecture/evals/fixtures/safeMigration.sql +3 -0
  35. package/skills/backend/databaseArchitecture/evals/fixtures/validSchema.sql +37 -0
  36. package/skills/backend/databaseArchitecture/policies/integrity.md +25 -0
  37. package/skills/backend/databaseArchitecture/policies/mandatory.md +32 -0
  38. package/skills/backend/databaseArchitecture/policies/migration.md +22 -0
  39. package/skills/backend/databaseArchitecture/policies/normalization.md +25 -0
  40. package/skills/backend/databaseArchitecture/policies/performance.md +26 -0
  41. package/skills/backend/databaseArchitecture/policies/recovery.md +23 -0
  42. package/skills/backend/databaseArchitecture/policies/security.md +26 -0
  43. package/skills/backend/databaseArchitecture/policies/tableCreationChecklist.md +70 -0
  44. package/skills/backend/databaseArchitecture/references/analyticsWarehousing.md +32 -0
  45. package/skills/backend/databaseArchitecture/references/apiReference.md +3 -0
  46. package/skills/backend/databaseArchitecture/references/backupDisasterRecovery.md +27 -0
  47. package/skills/backend/databaseArchitecture/references/dataModelingLifecycle.md +30 -0
  48. package/skills/backend/databaseArchitecture/references/databaseTaxonomy.md +32 -0
  49. package/skills/backend/databaseArchitecture/references/indexingOptimization.md +32 -0
  50. package/skills/backend/databaseArchitecture/references/normalizationTheory.md +61 -0
  51. package/skills/backend/databaseArchitecture/references/scalabilitySharding.md +37 -0
  52. package/skills/backend/databaseArchitecture/references/transactionConcurrency.md +39 -0
  53. package/skills/backend/databaseArchitecture/scripts/analyzeMigration.py +99 -0
  54. package/skills/backend/databaseArchitecture/scripts/auditDatabaseSchema.py +177 -0
  55. package/skills/backend/databaseArchitecture/scripts/inspectDatabaseIndexes.py +149 -0
  56. package/skills/backend/databaseArchitecture/templates/adrTemplate.md +32 -0
  57. package/skills/backend/databaseArchitecture/templates/databaseChecklist.md +29 -0
  58. package/skills/backend/databaseArchitecture/templates/migrationPlan.md +40 -0
  59. package/skills/backend/durableBackgroundJobs/SKILL.md +112 -0
  60. package/skills/backend/durableBackgroundJobs/evals/durableJobVerification.json +14 -0
  61. package/skills/backend/durableBackgroundJobs/references/apiReference.md +3 -0
  62. package/skills/backend/durableBackgroundJobs/references/durableStepPatterns.md +6 -0
  63. package/skills/backend/durableBackgroundJobs/references/idempotencyKeys.md +5 -0
  64. package/skills/backend/durableBackgroundJobs/scripts/testWorkflowDispatch.py +24 -0
  65. package/skills/backend/golangStandard/SKILL.md +155 -0
  66. package/skills/backend/golangStandard/evals/goVerification.json +14 -0
  67. package/skills/backend/golangStandard/references/apiReference.md +3 -0
  68. package/skills/backend/golangStandard/references/layoutGuide.md +26 -0
  69. package/skills/backend/golangStandard/references/slogPatterns.md +26 -0
  70. package/skills/backend/golangStandard/scripts/scaffoldGoModule.py +105 -0
  71. package/skills/backend/pythonStandard/SKILL.md +138 -0
  72. package/skills/backend/pythonStandard/evals/pythonVerification.json +14 -0
  73. package/skills/backend/pythonStandard/references/apiReference.md +3 -0
  74. package/skills/backend/pythonStandard/references/pydanticPatterns.md +16 -0
  75. package/skills/backend/pythonStandard/references/pyprojectSpecs.md +37 -0
  76. package/skills/backend/pythonStandard/scripts/scaffoldUvProject.py +79 -0
  77. package/skills/backend/upstash/SKILL.md +98 -0
  78. package/skills/backend/upstash/evals/upstashVerification.json +14 -0
  79. package/skills/backend/upstash/references/apiReference.md +3 -0
  80. package/skills/backend/upstash/references/qstashFlowControl.md +34 -0
  81. package/skills/backend/upstash/references/ratelimitPatterns.md +53 -0
  82. package/skills/backend/upstash/references/workflowPatterns.md +35 -0
  83. package/skills/backend/upstash/scripts/testRedisConnection.py +36 -0
  84. package/skills/cicdDevops/cicdPipeline/SKILL.md +148 -0
  85. package/skills/cicdDevops/cicdPipeline/evals/evalCicd.py +37 -0
  86. package/skills/cicdDevops/cicdPipeline/references/apiReference.md +3 -0
  87. package/skills/cicdDevops/cicdPipeline/references/cicdDeploymentPatterns.md +27 -0
  88. package/skills/cicdDevops/cicdPipeline/scripts/auditDockerfileSecurity.py +56 -0
  89. package/skills/dataAi/mcpServerDevelopment/SKILL.md +123 -0
  90. package/skills/dataAi/mcpServerDevelopment/evals/mcpVerification.json +14 -0
  91. package/skills/dataAi/mcpServerDevelopment/references/apiReference.md +3 -0
  92. package/skills/dataAi/mcpServerDevelopment/references/mcpClientConfigs.md +38 -0
  93. package/skills/dataAi/mcpServerDevelopment/references/toolSchemaDesign.md +6 -0
  94. package/skills/dataAi/mcpServerDevelopment/scripts/runFastMcpBoilerplate.py +36 -0
  95. package/skills/dataAi/ragPipelineProduction/SKILL.md +113 -0
  96. package/skills/dataAi/ragPipelineProduction/evals/ragVerification.json +14 -0
  97. package/skills/dataAi/ragPipelineProduction/references/apiReference.md +3 -0
  98. package/skills/dataAi/ragPipelineProduction/references/chunkingStrategies.md +10 -0
  99. package/skills/dataAi/ragPipelineProduction/references/rrfAlgorithm.md +13 -0
  100. package/skills/dataAi/ragPipelineProduction/scripts/runHybridRrfSearch.py +33 -0
  101. package/skills/devopsCloud/cloudflare/SKILL.md +282 -0
  102. package/skills/devopsCloud/cloudflare/assets/README.md +48 -0
  103. package/skills/devopsCloud/cloudflare/assets/ai/agents-sdk.md +118 -0
  104. package/skills/devopsCloud/cloudflare/assets/ai/ai-gateway.md +105 -0
  105. package/skills/devopsCloud/cloudflare/assets/ai/ai-search.md +129 -0
  106. package/skills/devopsCloud/cloudflare/assets/ai/workers-ai.md +127 -0
  107. package/skills/devopsCloud/cloudflare/assets/cli/c3.md +292 -0
  108. package/skills/devopsCloud/cloudflare/assets/cli/cf-cli.md +90 -0
  109. package/skills/devopsCloud/cloudflare/assets/cli/wrangler.md +43 -0
  110. package/skills/devopsCloud/cloudflare/assets/compute/cron-triggers.md +486 -0
  111. package/skills/devopsCloud/cloudflare/assets/compute/service-bindings.md +251 -0
  112. package/skills/devopsCloud/cloudflare/assets/compute/smart-placement.md +435 -0
  113. package/skills/devopsCloud/cloudflare/assets/compute/static-assets.md +220 -0
  114. package/skills/devopsCloud/cloudflare/assets/compute/workers.md +129 -0
  115. package/skills/devopsCloud/cloudflare/assets/database-storage/d1.md +105 -0
  116. package/skills/devopsCloud/cloudflare/assets/database-storage/durable-objects.md +122 -0
  117. package/skills/devopsCloud/cloudflare/assets/database-storage/hyperdrive.md +210 -0
  118. package/skills/devopsCloud/cloudflare/assets/database-storage/kv.md +198 -0
  119. package/skills/devopsCloud/cloudflare/assets/database-storage/queues.md +105 -0
  120. package/skills/devopsCloud/cloudflare/assets/database-storage/r2.md +105 -0
  121. package/skills/devopsCloud/cloudflare/assets/database-storage/vectorize.md +97 -0
  122. package/skills/devopsCloud/cloudflare/assets/database-storage/workflows.md +141 -0
  123. package/skills/devopsCloud/cloudflare/assets/llms.txt +143 -0
  124. package/skills/devopsCloud/cloudflare/assets/networking-security/cache-cdn.md +109 -0
  125. package/skills/devopsCloud/cloudflare/assets/networking-security/dns.md +71 -0
  126. package/skills/devopsCloud/cloudflare/assets/networking-security/rate-limiting.md +130 -0
  127. package/skills/devopsCloud/cloudflare/assets/networking-security/tunnels.md +57 -0
  128. package/skills/devopsCloud/cloudflare/assets/networking-security/waf.md +143 -0
  129. package/skills/devopsCloud/cloudflare/assets/troubleshooting/1xxx-errors.md +209 -0
  130. package/skills/devopsCloud/cloudflare/assets/troubleshooting/5xx-errors.md +111 -0
  131. package/skills/devopsCloud/cloudflare/assets/troubleshooting/http-status-codes.md +38 -0
  132. package/skills/devopsCloud/cloudflare/evals/evals.json +75 -0
  133. package/skills/devopsCloud/cloudflare/references/ai-gateway/README.md +27 -0
  134. package/skills/devopsCloud/cloudflare/references/ai-gateway/configuration.md +18 -0
  135. package/skills/devopsCloud/cloudflare/references/ai-gateway/dynamic-routing.md +15 -0
  136. package/skills/devopsCloud/cloudflare/references/ai-gateway/features.md +22 -0
  137. package/skills/devopsCloud/cloudflare/references/ai-gateway/sdk-integration.md +19 -0
  138. package/skills/devopsCloud/cloudflare/references/ai-gateway/troubleshooting.md +16 -0
  139. package/skills/devopsCloud/cloudflare/references/ai-search/README.md +25 -0
  140. package/skills/devopsCloud/cloudflare/references/ai-search/api.md +13 -0
  141. package/skills/devopsCloud/cloudflare/references/ai-search/configuration.md +16 -0
  142. package/skills/devopsCloud/cloudflare/references/ai-search/gotchas.md +13 -0
  143. package/skills/devopsCloud/cloudflare/references/ai-search/patterns.md +15 -0
  144. package/skills/devopsCloud/cloudflare/references/bindings/README.md +16 -0
  145. package/skills/devopsCloud/cloudflare/references/bindings/api.md +19 -0
  146. package/skills/devopsCloud/cloudflare/references/bindings/configuration.md +20 -0
  147. package/skills/devopsCloud/cloudflare/references/bindings/gotchas.md +18 -0
  148. package/skills/devopsCloud/cloudflare/references/bindings/patterns.md +20 -0
  149. package/skills/devopsCloud/cloudflare/references/browser-rendering/README.md +18 -0
  150. package/skills/devopsCloud/cloudflare/references/browser-rendering/api.md +12 -0
  151. package/skills/devopsCloud/cloudflare/references/browser-rendering/configuration.md +12 -0
  152. package/skills/devopsCloud/cloudflare/references/browser-rendering/gotchas.md +15 -0
  153. package/skills/devopsCloud/cloudflare/references/browser-rendering/patterns.md +12 -0
  154. package/skills/devopsCloud/cloudflare/references/cliComparison.md +93 -0
  155. package/skills/devopsCloud/cloudflare/references/containers/README.md +23 -0
  156. package/skills/devopsCloud/cloudflare/references/containers/api.md +13 -0
  157. package/skills/devopsCloud/cloudflare/references/containers/configuration.md +15 -0
  158. package/skills/devopsCloud/cloudflare/references/containers/gotchas.md +16 -0
  159. package/skills/devopsCloud/cloudflare/references/containers/patterns.md +18 -0
  160. package/skills/devopsCloud/cloudflare/references/cron-triggers/README.md +20 -0
  161. package/skills/devopsCloud/cloudflare/references/cron-triggers/api.md +16 -0
  162. package/skills/devopsCloud/cloudflare/references/cron-triggers/configuration.md +16 -0
  163. package/skills/devopsCloud/cloudflare/references/cron-triggers/gotchas.md +17 -0
  164. package/skills/devopsCloud/cloudflare/references/cron-triggers/patterns.md +18 -0
  165. package/skills/devopsCloud/cloudflare/references/d1/README.md +15 -0
  166. package/skills/devopsCloud/cloudflare/references/d1/api.md +18 -0
  167. package/skills/devopsCloud/cloudflare/references/d1/configuration.md +18 -0
  168. package/skills/devopsCloud/cloudflare/references/d1/gotchas.md +18 -0
  169. package/skills/devopsCloud/cloudflare/references/d1/patterns.md +21 -0
  170. package/skills/devopsCloud/cloudflare/references/frameworkCompatibility.md +110 -0
  171. package/skills/devopsCloud/cloudflare/references/hyperdrive/README.md +28 -0
  172. package/skills/devopsCloud/cloudflare/references/hyperdrive/api.md +26 -0
  173. package/skills/devopsCloud/cloudflare/references/hyperdrive/configuration.md +34 -0
  174. package/skills/devopsCloud/cloudflare/references/hyperdrive/gotchas.md +20 -0
  175. package/skills/devopsCloud/cloudflare/references/hyperdrive/patterns.md +15 -0
  176. package/skills/devopsCloud/cloudflare/references/images/README.md +12 -0
  177. package/skills/devopsCloud/cloudflare/references/images/api.md +13 -0
  178. package/skills/devopsCloud/cloudflare/references/images/configuration.md +17 -0
  179. package/skills/devopsCloud/cloudflare/references/images/gotchas.md +16 -0
  180. package/skills/devopsCloud/cloudflare/references/images/patterns.md +16 -0
  181. package/skills/devopsCloud/cloudflare/references/kv/README.md +15 -0
  182. package/skills/devopsCloud/cloudflare/references/kv/api.md +18 -0
  183. package/skills/devopsCloud/cloudflare/references/kv/configuration.md +16 -0
  184. package/skills/devopsCloud/cloudflare/references/kv/gotchas.md +17 -0
  185. package/skills/devopsCloud/cloudflare/references/kv/patterns.md +21 -0
  186. package/skills/devopsCloud/cloudflare/references/miniflare/README.md +22 -0
  187. package/skills/devopsCloud/cloudflare/references/miniflare/api.md +16 -0
  188. package/skills/devopsCloud/cloudflare/references/miniflare/configuration.md +16 -0
  189. package/skills/devopsCloud/cloudflare/references/miniflare/gotchas.md +15 -0
  190. package/skills/devopsCloud/cloudflare/references/miniflare/patterns.md +19 -0
  191. package/skills/devopsCloud/cloudflare/references/observability/README.md +27 -0
  192. package/skills/devopsCloud/cloudflare/references/observability/api.md +20 -0
  193. package/skills/devopsCloud/cloudflare/references/observability/configuration.md +23 -0
  194. package/skills/devopsCloud/cloudflare/references/observability/gotchas.md +25 -0
  195. package/skills/devopsCloud/cloudflare/references/observability/patterns.md +14 -0
  196. package/skills/devopsCloud/cloudflare/references/pages/README.md +20 -0
  197. package/skills/devopsCloud/cloudflare/references/pages/api.md +13 -0
  198. package/skills/devopsCloud/cloudflare/references/pages/configuration.md +16 -0
  199. package/skills/devopsCloud/cloudflare/references/pages/gotchas.md +19 -0
  200. package/skills/devopsCloud/cloudflare/references/pages/patterns.md +15 -0
  201. package/skills/devopsCloud/cloudflare/references/pages-functions/README.md +20 -0
  202. package/skills/devopsCloud/cloudflare/references/pages-functions/api.md +13 -0
  203. package/skills/devopsCloud/cloudflare/references/pages-functions/configuration.md +14 -0
  204. package/skills/devopsCloud/cloudflare/references/pages-functions/gotchas.md +17 -0
  205. package/skills/devopsCloud/cloudflare/references/pages-functions/patterns.md +16 -0
  206. package/skills/devopsCloud/cloudflare/references/productSelectionMatrix.md +54 -0
  207. package/skills/devopsCloud/cloudflare/references/queues/README.md +24 -0
  208. package/skills/devopsCloud/cloudflare/references/queues/api.md +16 -0
  209. package/skills/devopsCloud/cloudflare/references/queues/configuration.md +20 -0
  210. package/skills/devopsCloud/cloudflare/references/queues/gotchas.md +18 -0
  211. package/skills/devopsCloud/cloudflare/references/queues/patterns.md +21 -0
  212. package/skills/devopsCloud/cloudflare/references/r2/README.md +26 -0
  213. package/skills/devopsCloud/cloudflare/references/r2/api.md +16 -0
  214. package/skills/devopsCloud/cloudflare/references/r2/configuration.md +19 -0
  215. package/skills/devopsCloud/cloudflare/references/r2/gotchas.md +17 -0
  216. package/skills/devopsCloud/cloudflare/references/r2/patterns.md +18 -0
  217. package/skills/devopsCloud/cloudflare/references/secrets-store/README.md +22 -0
  218. package/skills/devopsCloud/cloudflare/references/secrets-store/api.md +21 -0
  219. package/skills/devopsCloud/cloudflare/references/secrets-store/configuration.md +25 -0
  220. package/skills/devopsCloud/cloudflare/references/secrets-store/gotchas.md +19 -0
  221. package/skills/devopsCloud/cloudflare/references/secrets-store/patterns.md +27 -0
  222. package/skills/devopsCloud/cloudflare/references/skill-feedback.md +41 -0
  223. package/skills/devopsCloud/cloudflare/references/static-assets/README.md +21 -0
  224. package/skills/devopsCloud/cloudflare/references/static-assets/api.md +16 -0
  225. package/skills/devopsCloud/cloudflare/references/static-assets/configuration.md +16 -0
  226. package/skills/devopsCloud/cloudflare/references/static-assets/gotchas.md +18 -0
  227. package/skills/devopsCloud/cloudflare/references/static-assets/patterns.md +17 -0
  228. package/skills/devopsCloud/cloudflare/references/stream/README.md +22 -0
  229. package/skills/devopsCloud/cloudflare/references/stream/api-live.md +18 -0
  230. package/skills/devopsCloud/cloudflare/references/stream/api.md +21 -0
  231. package/skills/devopsCloud/cloudflare/references/stream/configuration.md +18 -0
  232. package/skills/devopsCloud/cloudflare/references/stream/gotchas.md +18 -0
  233. package/skills/devopsCloud/cloudflare/references/stream/patterns.md +22 -0
  234. package/skills/devopsCloud/cloudflare/references/tail-workers/README.md +21 -0
  235. package/skills/devopsCloud/cloudflare/references/tail-workers/api.md +13 -0
  236. package/skills/devopsCloud/cloudflare/references/tail-workers/configuration.md +15 -0
  237. package/skills/devopsCloud/cloudflare/references/tail-workers/gotchas.md +16 -0
  238. package/skills/devopsCloud/cloudflare/references/tail-workers/patterns.md +15 -0
  239. package/skills/devopsCloud/cloudflare/references/tunnel/README.md +20 -0
  240. package/skills/devopsCloud/cloudflare/references/tunnel/api.md +14 -0
  241. package/skills/devopsCloud/cloudflare/references/tunnel/configuration.md +14 -0
  242. package/skills/devopsCloud/cloudflare/references/tunnel/gotchas.md +15 -0
  243. package/skills/devopsCloud/cloudflare/references/tunnel/networking.md +14 -0
  244. package/skills/devopsCloud/cloudflare/references/tunnel/patterns.md +15 -0
  245. package/skills/devopsCloud/cloudflare/references/vectorize/README.md +22 -0
  246. package/skills/devopsCloud/cloudflare/references/vectorize/api.md +18 -0
  247. package/skills/devopsCloud/cloudflare/references/vectorize/configuration.md +19 -0
  248. package/skills/devopsCloud/cloudflare/references/vectorize/gotchas.md +15 -0
  249. package/skills/devopsCloud/cloudflare/references/vectorize/patterns.md +24 -0
  250. package/skills/devopsCloud/cloudflare/references/waf/README.md +21 -0
  251. package/skills/devopsCloud/cloudflare/references/waf/api.md +17 -0
  252. package/skills/devopsCloud/cloudflare/references/waf/configuration.md +18 -0
  253. package/skills/devopsCloud/cloudflare/references/waf/gotchas.md +19 -0
  254. package/skills/devopsCloud/cloudflare/references/waf/patterns.md +17 -0
  255. package/skills/devopsCloud/cloudflare/references/workers-ai/README.md +24 -0
  256. package/skills/devopsCloud/cloudflare/references/workers-ai/api.md +13 -0
  257. package/skills/devopsCloud/cloudflare/references/workers-ai/configuration.md +16 -0
  258. package/skills/devopsCloud/cloudflare/references/workers-ai/gotchas.md +15 -0
  259. package/skills/devopsCloud/cloudflare/references/workers-ai/patterns.md +14 -0
  260. package/skills/devopsCloud/cloudflare/references/workflows/README.md +23 -0
  261. package/skills/devopsCloud/cloudflare/references/workflows/api.md +17 -0
  262. package/skills/devopsCloud/cloudflare/references/workflows/configuration.md +18 -0
  263. package/skills/devopsCloud/cloudflare/references/workflows/gotchas.md +19 -0
  264. package/skills/devopsCloud/cloudflare/references/workflows/patterns.md +30 -0
  265. package/skills/devopsCloud/cloudflare/scripts/auditCloudflareProduction.py +95 -0
  266. package/skills/foundation/promptEvalTesting/SKILL.md +114 -0
  267. package/skills/foundation/promptEvalTesting/evals/promptEvalVerification.json +14 -0
  268. package/skills/foundation/promptEvalTesting/references/apiReference.md +3 -0
  269. package/skills/foundation/promptEvalTesting/references/evalMetricsCatalog.md +7 -0
  270. package/skills/foundation/promptEvalTesting/references/promptfooConfigSpecs.md +16 -0
  271. package/skills/foundation/promptEvalTesting/scripts/runPromptEvalSuite.py +29 -0
  272. package/skills/frontend/astro/SKILL.md +327 -0
  273. package/skills/frontend/astro/assets/README.md +71 -0
  274. package/skills/frontend/astro/assets/add-content-to-your-site/content-collections.md +1061 -0
  275. package/skills/frontend/astro/assets/add-content-to-your-site/data-fetching.md +109 -0
  276. package/skills/frontend/astro/assets/add-content-to-your-site/images.md +719 -0
  277. package/skills/frontend/astro/assets/add-content-to-your-site/markdown.md +725 -0
  278. package/skills/frontend/astro/assets/build-your-ui/components.md +402 -0
  279. package/skills/frontend/astro/assets/build-your-ui/fonts.md +437 -0
  280. package/skills/frontend/astro/assets/build-your-ui/front-end-frameworks.md +245 -0
  281. package/skills/frontend/astro/assets/build-your-ui/layouts.md +267 -0
  282. package/skills/frontend/astro/assets/build-your-ui/scripts-and-event-handling.md +229 -0
  283. package/skills/frontend/astro/assets/build-your-ui/styles-and-css.md +782 -0
  284. package/skills/frontend/astro/assets/build-your-ui/syntax-highlighting.md +269 -0
  285. package/skills/frontend/astro/assets/configuration/build-with-ai.md +389 -0
  286. package/skills/frontend/astro/assets/configuration/configuration-overview.md +122 -0
  287. package/skills/frontend/astro/assets/configuration/dev-toolbar.md +86 -0
  288. package/skills/frontend/astro/assets/configuration/editor-setup.md +166 -0
  289. package/skills/frontend/astro/assets/configuration/environment-variables.md +352 -0
  290. package/skills/frontend/astro/assets/configuration/typescript.md +379 -0
  291. package/skills/frontend/astro/assets/configuration/working-with-integrations.md +606 -0
  292. package/skills/frontend/astro/assets/reference/adapter-reference.md +1242 -0
  293. package/skills/frontend/astro/assets/reference/cli-reference.md +575 -0
  294. package/skills/frontend/astro/assets/reference/configuration-reference.md +3144 -0
  295. package/skills/frontend/astro/assets/reference/content-loader-reference.md +1682 -0
  296. package/skills/frontend/astro/assets/reference/directives-reference.md +324 -0
  297. package/skills/frontend/astro/assets/reference/image-service-reference.md +346 -0
  298. package/skills/frontend/astro/assets/reference/integrations-reference.md +2813 -0
  299. package/skills/frontend/astro/assets/reference/modules/astro-actions.md +604 -0
  300. package/skills/frontend/astro/assets/reference/modules/astro-app.md +460 -0
  301. package/skills/frontend/astro/assets/reference/modules/astro-assets.md +1657 -0
  302. package/skills/frontend/astro/assets/reference/modules/astro-config.md +395 -0
  303. package/skills/frontend/astro/assets/reference/modules/astro-content.md +720 -0
  304. package/skills/frontend/astro/assets/reference/modules/astro-env.md +46 -0
  305. package/skills/frontend/astro/assets/reference/modules/astro-fetch.md +346 -0
  306. package/skills/frontend/astro/assets/reference/modules/astro-hono.md +37 -0
  307. package/skills/frontend/astro/assets/reference/modules/astro-i18n.md +462 -0
  308. package/skills/frontend/astro/assets/reference/modules/astro-middleware.md +292 -0
  309. package/skills/frontend/astro/assets/reference/modules/astro-static-paths.md +74 -0
  310. package/skills/frontend/astro/assets/reference/modules/astro-transitions.md +595 -0
  311. package/skills/frontend/astro/assets/reference/modules/astro-zod.md +120 -0
  312. package/skills/frontend/astro/assets/reference/session-driver-reference.md +205 -0
  313. package/skills/frontend/astro/assets/routing-and-navigation/endpoints.md +251 -0
  314. package/skills/frontend/astro/assets/routing-and-navigation/internationalization.md +374 -0
  315. package/skills/frontend/astro/assets/routing-and-navigation/middleware.md +288 -0
  316. package/skills/frontend/astro/assets/routing-and-navigation/pages.md +205 -0
  317. package/skills/frontend/astro/assets/routing-and-navigation/prefetch.md +273 -0
  318. package/skills/frontend/astro/assets/routing-and-navigation/routing.md +760 -0
  319. package/skills/frontend/astro/assets/routing-and-navigation/view-transitions.md +792 -0
  320. package/skills/frontend/astro/assets/server-rendering/actions.md +770 -0
  321. package/skills/frontend/astro/assets/server-rendering/caching.md +255 -0
  322. package/skills/frontend/astro/assets/server-rendering/on-demand-rendering.md +289 -0
  323. package/skills/frontend/astro/assets/server-rendering/server-islands.md +126 -0
  324. package/skills/frontend/astro/assets/server-rendering/sessions.md +270 -0
  325. package/skills/frontend/astro/assets/start-a-new-project/develop-and-build.md +147 -0
  326. package/skills/frontend/astro/assets/start-a-new-project/installation.md +342 -0
  327. package/skills/frontend/astro/assets/start-a-new-project/project-structure.md +137 -0
  328. package/skills/frontend/astro/assets/upgrade-and-troubleshooting/testing.md +412 -0
  329. package/skills/frontend/astro/assets/upgrade-and-troubleshooting/troubleshooting.md +229 -0
  330. package/skills/frontend/astro/assets/upgrade-and-troubleshooting/upgrade-astro.md +205 -0
  331. package/skills/frontend/astro/assets/welcome/courses.md +46 -0
  332. package/skills/frontend/astro/assets/welcome/islands-architecture.md +135 -0
  333. package/skills/frontend/astro/assets/welcome/why-astro.md +90 -0
  334. package/skills/frontend/astro/evals/evals.json +66 -0
  335. package/skills/frontend/astro/references/contentCollections.md +164 -0
  336. package/skills/frontend/astro/references/islandsArchitecture.md +128 -0
  337. package/skills/frontend/astro/references/serverIslandsAndActions.md +187 -0
  338. package/skills/frontend/astro/scripts/auditAstroProduction.py +78 -0
  339. package/skills/frontend/generativeUi/SKILL.md +128 -0
  340. package/skills/frontend/generativeUi/evals/generativeUiVerification.json +14 -0
  341. package/skills/frontend/generativeUi/references/apiReference.md +3 -0
  342. package/skills/frontend/generativeUi/references/clientToolComponentMapping.md +8 -0
  343. package/skills/frontend/generativeUi/references/dataStreamProtocol.md +10 -0
  344. package/skills/frontend/generativeUi/scripts/generateUiComponentStub.py +46 -0
  345. package/skills/frontend/nextjs/SKILL.md +138 -0
  346. package/skills/frontend/nextjs/assets/README.md +67 -0
  347. package/skills/frontend/nextjs/assets/api-reference/cli/create-next-app.md +210 -0
  348. package/skills/frontend/nextjs/assets/api-reference/cli/next.md +484 -0
  349. package/skills/frontend/nextjs/assets/api-reference/components/font.md +952 -0
  350. package/skills/frontend/nextjs/assets/api-reference/components/form.md +387 -0
  351. package/skills/frontend/nextjs/assets/api-reference/components/image.md +1372 -0
  352. package/skills/frontend/nextjs/assets/api-reference/components/link.md +954 -0
  353. package/skills/frontend/nextjs/assets/api-reference/components/script.md +421 -0
  354. package/skills/frontend/nextjs/assets/api-reference/directives/use-cache-private.md +211 -0
  355. package/skills/frontend/nextjs/assets/api-reference/directives/use-cache-remote.md +652 -0
  356. package/skills/frontend/nextjs/assets/api-reference/directives/use-cache.md +848 -0
  357. package/skills/frontend/nextjs/assets/api-reference/directives/use-client.md +149 -0
  358. package/skills/frontend/nextjs/assets/api-reference/directives/use-server.md +234 -0
  359. package/skills/frontend/nextjs/assets/api-reference/edge-runtime.md +188 -0
  360. package/skills/frontend/nextjs/assets/api-reference/file-conventions/default.md +80 -0
  361. package/skills/frontend/nextjs/assets/api-reference/file-conventions/dynamic-routes.md +417 -0
  362. package/skills/frontend/nextjs/assets/api-reference/file-conventions/error.md +361 -0
  363. package/skills/frontend/nextjs/assets/api-reference/file-conventions/forbidden.md +75 -0
  364. package/skills/frontend/nextjs/assets/api-reference/file-conventions/instrumentation-client.md +308 -0
  365. package/skills/frontend/nextjs/assets/api-reference/file-conventions/instrumentation.md +177 -0
  366. package/skills/frontend/nextjs/assets/api-reference/file-conventions/intercepting-routes.md +78 -0
  367. package/skills/frontend/nextjs/assets/api-reference/file-conventions/layout.md +803 -0
  368. package/skills/frontend/nextjs/assets/api-reference/file-conventions/loading.md +209 -0
  369. package/skills/frontend/nextjs/assets/api-reference/file-conventions/mdx-components.md +84 -0
  370. package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/app-icons.md +302 -0
  371. package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/manifest.md +90 -0
  372. package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/opengraph-image.md +580 -0
  373. package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/robots.md +234 -0
  374. package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/sitemap.md +459 -0
  375. package/skills/frontend/nextjs/assets/api-reference/file-conventions/not-found.md +278 -0
  376. package/skills/frontend/nextjs/assets/api-reference/file-conventions/page.md +283 -0
  377. package/skills/frontend/nextjs/assets/api-reference/file-conventions/parallel-routes.md +517 -0
  378. package/skills/frontend/nextjs/assets/api-reference/file-conventions/proxy.md +857 -0
  379. package/skills/frontend/nextjs/assets/api-reference/file-conventions/public-folder.md +47 -0
  380. package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-groups.md +40 -0
  381. package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/dynamicParams.md +40 -0
  382. package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/ensureStatic.md +195 -0
  383. package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/instant.md +204 -0
  384. package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/maxDuration.md +42 -0
  385. package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/preferredRegion.md +55 -0
  386. package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/prefetch.md +113 -0
  387. package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/runtime.md +43 -0
  388. package/skills/frontend/nextjs/assets/api-reference/file-conventions/route.md +772 -0
  389. package/skills/frontend/nextjs/assets/api-reference/file-conventions/src-folder.md +42 -0
  390. package/skills/frontend/nextjs/assets/api-reference/file-conventions/template.md +174 -0
  391. package/skills/frontend/nextjs/assets/api-reference/file-conventions/unauthorized.md +143 -0
  392. package/skills/frontend/nextjs/assets/api-reference/functions/after.md +332 -0
  393. package/skills/frontend/nextjs/assets/api-reference/functions/cacheLife.md +642 -0
  394. package/skills/frontend/nextjs/assets/api-reference/functions/cacheTag.md +272 -0
  395. package/skills/frontend/nextjs/assets/api-reference/functions/catchError.md +267 -0
  396. package/skills/frontend/nextjs/assets/api-reference/functions/connection.md +114 -0
  397. package/skills/frontend/nextjs/assets/api-reference/functions/cookies.md +349 -0
  398. package/skills/frontend/nextjs/assets/api-reference/functions/draft-mode.md +173 -0
  399. package/skills/frontend/nextjs/assets/api-reference/functions/fetch.md +141 -0
  400. package/skills/frontend/nextjs/assets/api-reference/functions/forbidden.md +327 -0
  401. package/skills/frontend/nextjs/assets/api-reference/functions/generate-image-metadata.md +311 -0
  402. package/skills/frontend/nextjs/assets/api-reference/functions/generate-metadata.md +1510 -0
  403. package/skills/frontend/nextjs/assets/api-reference/functions/generate-sitemaps.md +102 -0
  404. package/skills/frontend/nextjs/assets/api-reference/functions/generate-static-params.md +606 -0
  405. package/skills/frontend/nextjs/assets/api-reference/functions/generate-viewport.md +347 -0
  406. package/skills/frontend/nextjs/assets/api-reference/functions/headers.md +92 -0
  407. package/skills/frontend/nextjs/assets/api-reference/functions/image-response.md +225 -0
  408. package/skills/frontend/nextjs/assets/api-reference/functions/io.md +131 -0
  409. package/skills/frontend/nextjs/assets/api-reference/functions/navigation.md +220 -0
  410. package/skills/frontend/nextjs/assets/api-reference/functions/next-request.md +116 -0
  411. package/skills/frontend/nextjs/assets/api-reference/functions/next-response.md +219 -0
  412. package/skills/frontend/nextjs/assets/api-reference/functions/next-root-params.md +479 -0
  413. package/skills/frontend/nextjs/assets/api-reference/functions/not-found.md +269 -0
  414. package/skills/frontend/nextjs/assets/api-reference/functions/permanentRedirect.md +92 -0
  415. package/skills/frontend/nextjs/assets/api-reference/functions/prefetch.md +202 -0
  416. package/skills/frontend/nextjs/assets/api-reference/functions/redirect.md +255 -0
  417. package/skills/frontend/nextjs/assets/api-reference/functions/refresh.md +91 -0
  418. package/skills/frontend/nextjs/assets/api-reference/functions/revalidatePath.md +248 -0
  419. package/skills/frontend/nextjs/assets/api-reference/functions/revalidateTag.md +175 -0
  420. package/skills/frontend/nextjs/assets/api-reference/functions/unauthorized.md +389 -0
  421. package/skills/frontend/nextjs/assets/api-reference/functions/unstable_cache.md +131 -0
  422. package/skills/frontend/nextjs/assets/api-reference/functions/unstable_noStore.md +61 -0
  423. package/skills/frontend/nextjs/assets/api-reference/functions/unstable_rethrow.md +79 -0
  424. package/skills/frontend/nextjs/assets/api-reference/functions/updateTag.md +173 -0
  425. package/skills/frontend/nextjs/assets/api-reference/functions/use-link-status.md +268 -0
  426. package/skills/frontend/nextjs/assets/api-reference/functions/use-offline.md +222 -0
  427. package/skills/frontend/nextjs/assets/api-reference/functions/use-params.md +102 -0
  428. package/skills/frontend/nextjs/assets/api-reference/functions/use-pathname.md +189 -0
  429. package/skills/frontend/nextjs/assets/api-reference/functions/use-report-web-vitals.md +175 -0
  430. package/skills/frontend/nextjs/assets/api-reference/functions/use-router.md +214 -0
  431. package/skills/frontend/nextjs/assets/api-reference/functions/use-search-params.md +416 -0
  432. package/skills/frontend/nextjs/assets/api-reference/functions/use-selected-layout-segment.md +214 -0
  433. package/skills/frontend/nextjs/assets/api-reference/functions/use-selected-layout-segments.md +116 -0
  434. package/skills/frontend/nextjs/assets/api-reference/functions/use-server-inserted-html.md +145 -0
  435. package/skills/frontend/nextjs/assets/api-reference/functions/userAgent.md +95 -0
  436. package/skills/frontend/nextjs/assets/api-reference/turbopack.md +552 -0
  437. package/skills/frontend/nextjs/assets/architecture/accessibility.md +47 -0
  438. package/skills/frontend/nextjs/assets/architecture/fast-refresh.md +122 -0
  439. package/skills/frontend/nextjs/assets/architecture/nextjs-compiler.md +376 -0
  440. package/skills/frontend/nextjs/assets/architecture/supported-browsers.md +146 -0
  441. package/skills/frontend/nextjs/assets/community/contribution-guide.md +459 -0
  442. package/skills/frontend/nextjs/assets/community/rspack.md +25 -0
  443. package/skills/frontend/nextjs/assets/getting-started/caching.md +626 -0
  444. package/skills/frontend/nextjs/assets/getting-started/css.md +336 -0
  445. package/skills/frontend/nextjs/assets/getting-started/deploying.md +115 -0
  446. package/skills/frontend/nextjs/assets/getting-started/error-handling.md +485 -0
  447. package/skills/frontend/nextjs/assets/getting-started/fetching-data.md +743 -0
  448. package/skills/frontend/nextjs/assets/getting-started/fonts.md +232 -0
  449. package/skills/frontend/nextjs/assets/getting-started/images.md +272 -0
  450. package/skills/frontend/nextjs/assets/getting-started/installation.md +446 -0
  451. package/skills/frontend/nextjs/assets/getting-started/layouts-and-pages.md +386 -0
  452. package/skills/frontend/nextjs/assets/getting-started/linking-and-navigating.md +475 -0
  453. package/skills/frontend/nextjs/assets/getting-started/metadata-and-og-images.md +370 -0
  454. package/skills/frontend/nextjs/assets/getting-started/mutating-data.md +679 -0
  455. package/skills/frontend/nextjs/assets/getting-started/project-structure.md +290 -0
  456. package/skills/frontend/nextjs/assets/getting-started/proxy.md +107 -0
  457. package/skills/frontend/nextjs/assets/getting-started/revalidating.md +241 -0
  458. package/skills/frontend/nextjs/assets/getting-started/route-handlers.md +233 -0
  459. package/skills/frontend/nextjs/assets/getting-started/server-and-client-components.md +683 -0
  460. package/skills/frontend/nextjs/assets/getting-started/upgrading.md +137 -0
  461. package/skills/frontend/nextjs/assets/glossary.md +315 -0
  462. package/skills/frontend/nextjs/evals/nextjsVerification.json +14 -0
  463. package/skills/frontend/nextjs/references/apiReference.md +3 -0
  464. package/skills/frontend/nextjs/references/dataAccessLayer.md +39 -0
  465. package/skills/frontend/nextjs/references/nextjsFeatureMap.md +276 -0
  466. package/skills/frontend/nextjs/references/productionChecklist.md +49 -0
  467. package/skills/frontend/nextjs/references/securityHeadersCsp.md +44 -0
  468. package/skills/frontend/nextjs/scripts/auditProductionReadiness.py +85 -0
  469. package/skills/frontend/shadcn-ui/SKILL.md +102 -0
  470. package/skills/frontend/shadcn-ui/assets/README.md +82 -0
  471. package/skills/frontend/shadcn-ui/assets/advanced/javascript.md +44 -0
  472. package/skills/frontend/shadcn-ui/assets/advanced/monorepo.md +254 -0
  473. package/skills/frontend/shadcn-ui/assets/advanced/react-19.md +166 -0
  474. package/skills/frontend/shadcn-ui/assets/advanced/tailwind-v4.md +333 -0
  475. package/skills/frontend/shadcn-ui/assets/ai-elements/chain-of-thought.md +519 -0
  476. package/skills/frontend/shadcn-ui/assets/ai-elements/chat.md +581 -0
  477. package/skills/frontend/shadcn-ui/assets/ai-elements/checkpoint.md +243 -0
  478. package/skills/frontend/shadcn-ui/assets/ai-elements/confirmation.md +382 -0
  479. package/skills/frontend/shadcn-ui/assets/ai-elements/context.md +188 -0
  480. package/skills/frontend/shadcn-ui/assets/ai-elements/file-tree.md +248 -0
  481. package/skills/frontend/shadcn-ui/assets/ai-elements/index.md +307 -0
  482. package/skills/frontend/shadcn-ui/assets/ai-elements/inline-citation.md +219 -0
  483. package/skills/frontend/shadcn-ui/assets/ai-elements/message.md +298 -0
  484. package/skills/frontend/shadcn-ui/assets/ai-elements/model-selector.md +368 -0
  485. package/skills/frontend/shadcn-ui/assets/ai-elements/plan.md +398 -0
  486. package/skills/frontend/shadcn-ui/assets/ai-elements/prompt-input.md +403 -0
  487. package/skills/frontend/shadcn-ui/assets/ai-elements/queue.md +517 -0
  488. package/skills/frontend/shadcn-ui/assets/ai-elements/reasoning.md +349 -0
  489. package/skills/frontend/shadcn-ui/assets/ai-elements/sources.md +303 -0
  490. package/skills/frontend/shadcn-ui/assets/ai-elements/stack-trace.md +514 -0
  491. package/skills/frontend/shadcn-ui/assets/ai-elements/subagent.md +551 -0
  492. package/skills/frontend/shadcn-ui/assets/ai-elements/suggestion.md +246 -0
  493. package/skills/frontend/shadcn-ui/assets/ai-elements/task.md +380 -0
  494. package/skills/frontend/shadcn-ui/assets/ai-elements/terminal.md +463 -0
  495. package/skills/frontend/shadcn-ui/assets/ai-elements/test-results.md +641 -0
  496. package/skills/frontend/shadcn-ui/assets/ai-elements/tool.md +915 -0
  497. package/skills/frontend/shadcn-ui/assets/components/accordion.md +490 -0
  498. package/skills/frontend/shadcn-ui/assets/components/alert-dialog.md +520 -0
  499. package/skills/frontend/shadcn-ui/assets/components/alert.md +351 -0
  500. package/skills/frontend/shadcn-ui/assets/components/aspect-ratio.md +206 -0
  501. package/skills/frontend/shadcn-ui/assets/components/attachment.md +715 -0
  502. package/skills/frontend/shadcn-ui/assets/components/avatar.md +581 -0
  503. package/skills/frontend/shadcn-ui/assets/components/badge.md +276 -0
  504. package/skills/frontend/shadcn-ui/assets/components/breadcrumb.md +556 -0
  505. package/skills/frontend/shadcn-ui/assets/components/bubble.md +706 -0
  506. package/skills/frontend/shadcn-ui/assets/components/button-group.md +969 -0
  507. package/skills/frontend/shadcn-ui/assets/components/button.md +523 -0
  508. package/skills/frontend/shadcn-ui/assets/components/calendar.md +959 -0
  509. package/skills/frontend/shadcn-ui/assets/components/card.md +684 -0
  510. package/skills/frontend/shadcn-ui/assets/components/carousel.md +643 -0
  511. package/skills/frontend/shadcn-ui/assets/components/chart.md +1295 -0
  512. package/skills/frontend/shadcn-ui/assets/components/checkbox.md +553 -0
  513. package/skills/frontend/shadcn-ui/assets/components/code-block.md +2041 -0
  514. package/skills/frontend/shadcn-ui/assets/components/collapsible.md +504 -0
  515. package/skills/frontend/shadcn-ui/assets/components/combobox.md +1102 -0
  516. package/skills/frontend/shadcn-ui/assets/components/command.md +682 -0
  517. package/skills/frontend/shadcn-ui/assets/components/context-menu.md +949 -0
  518. package/skills/frontend/shadcn-ui/assets/components/data-table.md +1667 -0
  519. package/skills/frontend/shadcn-ui/assets/components/date-picker.md +698 -0
  520. package/skills/frontend/shadcn-ui/assets/components/dialog.md +454 -0
  521. package/skills/frontend/shadcn-ui/assets/components/direction.md +205 -0
  522. package/skills/frontend/shadcn-ui/assets/components/drawer.md +806 -0
  523. package/skills/frontend/shadcn-ui/assets/components/dropdown-menu.md +1315 -0
  524. package/skills/frontend/shadcn-ui/assets/components/empty.md +562 -0
  525. package/skills/frontend/shadcn-ui/assets/components/field.md +1321 -0
  526. package/skills/frontend/shadcn-ui/assets/components/hover-card.md +342 -0
  527. package/skills/frontend/shadcn-ui/assets/components/index.md +82 -0
  528. package/skills/frontend/shadcn-ui/assets/components/input-group.md +980 -0
  529. package/skills/frontend/shadcn-ui/assets/components/input-otp.md +551 -0
  530. package/skills/frontend/shadcn-ui/assets/components/input.md +555 -0
  531. package/skills/frontend/shadcn-ui/assets/components/item.md +937 -0
  532. package/skills/frontend/shadcn-ui/assets/components/kbd.md +290 -0
  533. package/skills/frontend/shadcn-ui/assets/components/label.md +327 -0
  534. package/skills/frontend/shadcn-ui/assets/components/marker.md +445 -0
  535. package/skills/frontend/shadcn-ui/assets/components/menubar.md +804 -0
  536. package/skills/frontend/shadcn-ui/assets/components/message-scroller.md +2770 -0
  537. package/skills/frontend/shadcn-ui/assets/components/message.md +618 -0
  538. package/skills/frontend/shadcn-ui/assets/components/native-select.md +321 -0
  539. package/skills/frontend/shadcn-ui/assets/components/navigation-menu.md +568 -0
  540. package/skills/frontend/shadcn-ui/assets/components/pagination.md +425 -0
  541. package/skills/frontend/shadcn-ui/assets/components/popover.md +402 -0
  542. package/skills/frontend/shadcn-ui/assets/components/progress.md +240 -0
  543. package/skills/frontend/shadcn-ui/assets/components/questionnaire.md +2055 -0
  544. package/skills/frontend/shadcn-ui/assets/components/radio-group.md +440 -0
  545. package/skills/frontend/shadcn-ui/assets/components/resizable.md +302 -0
  546. package/skills/frontend/shadcn-ui/assets/components/scroll-area.md +226 -0
  547. package/skills/frontend/shadcn-ui/assets/components/select.md +647 -0
  548. package/skills/frontend/shadcn-ui/assets/components/separator.md +235 -0
  549. package/skills/frontend/shadcn-ui/assets/components/sheet.md +354 -0
  550. package/skills/frontend/shadcn-ui/assets/components/sidebar.md +1156 -0
  551. package/skills/frontend/shadcn-ui/assets/components/skeleton.md +217 -0
  552. package/skills/frontend/shadcn-ui/assets/components/slider.md +253 -0
  553. package/skills/frontend/shadcn-ui/assets/components/spinner.md +352 -0
  554. package/skills/frontend/shadcn-ui/assets/components/switch.md +296 -0
  555. package/skills/frontend/shadcn-ui/assets/components/table.md +572 -0
  556. package/skills/frontend/shadcn-ui/assets/components/tabs.md +425 -0
  557. package/skills/frontend/shadcn-ui/assets/components/textarea.md +218 -0
  558. package/skills/frontend/shadcn-ui/assets/components/toast.md +260 -0
  559. package/skills/frontend/shadcn-ui/assets/components/toggle-group.md +419 -0
  560. package/skills/frontend/shadcn-ui/assets/components/toggle.md +220 -0
  561. package/skills/frontend/shadcn-ui/assets/components/tooltip.md +332 -0
  562. package/skills/frontend/shadcn-ui/assets/components/trace.md +1890 -0
  563. package/skills/frontend/shadcn-ui/assets/components/typography.md +561 -0
  564. package/skills/frontend/shadcn-ui/assets/dark-mode/next.md +108 -0
  565. package/skills/frontend/shadcn-ui/assets/dark-mode/overview.md +75 -0
  566. package/skills/frontend/shadcn-ui/assets/dark-mode/vite.md +144 -0
  567. package/skills/frontend/shadcn-ui/assets/forms/next.md +716 -0
  568. package/skills/frontend/shadcn-ui/assets/forms/overview.md +60 -0
  569. package/skills/frontend/shadcn-ui/assets/forms/react-hook-form.md +2055 -0
  570. package/skills/frontend/shadcn-ui/assets/forms/tanstack-form.md +2236 -0
  571. package/skills/frontend/shadcn-ui/assets/installation/astro.md +252 -0
  572. package/skills/frontend/shadcn-ui/assets/installation/manual.md +255 -0
  573. package/skills/frontend/shadcn-ui/assets/installation/next.md +256 -0
  574. package/skills/frontend/shadcn-ui/assets/installation/react-router.md +226 -0
  575. package/skills/frontend/shadcn-ui/assets/installation/remix.md +52 -0
  576. package/skills/frontend/shadcn-ui/assets/installation/vite.md +314 -0
  577. package/skills/frontend/shadcn-ui/assets/mcp/mcp.md +338 -0
  578. package/skills/frontend/shadcn-ui/assets/overview/changelog.md +6 -0
  579. package/skills/frontend/shadcn-ui/assets/overview/cli.md +738 -0
  580. package/skills/frontend/shadcn-ui/assets/overview/components-json.md +379 -0
  581. package/skills/frontend/shadcn-ui/assets/overview/directory.md +74 -0
  582. package/skills/frontend/shadcn-ui/assets/overview/introduction.md +77 -0
  583. package/skills/frontend/shadcn-ui/assets/overview/skills.md +71 -0
  584. package/skills/frontend/shadcn-ui/assets/overview/theming.md +304 -0
  585. package/skills/frontend/shadcn-ui/assets/overview/typeset.md +242 -0
  586. package/skills/frontend/shadcn-ui/assets/registry/getting-started.md +648 -0
  587. package/skills/frontend/shadcn-ui/assets/registry/overview.md +90 -0
  588. package/skills/frontend/shadcn-ui/assets/registry/registry-item-json.md +483 -0
  589. package/skills/frontend/shadcn-ui/assets/registry/registry-json.md +178 -0
  590. package/skills/frontend/shadcn-ui/evals/componentVerification.json +19 -0
  591. package/skills/frontend/shadcn-ui/references/aiComponentsCatalog.md +51 -0
  592. package/skills/frontend/shadcn-ui/references/apiReference.md +3 -0
  593. package/skills/frontend/shadcn-ui/references/blocksCatalog.md +32 -0
  594. package/skills/frontend/shadcn-ui/references/cliCommands.md +47 -0
  595. package/skills/frontend/shadcn-ui/references/componentMarkdownSources.md +48 -0
  596. package/skills/frontend/shadcn-ui/scripts/fetchComponentDocs.py +43 -0
  597. package/skills/frontend/tsxReactStandard/SKILL.md +150 -0
  598. package/skills/frontend/tsxReactStandard/evals/tsxVerification.json +14 -0
  599. package/skills/frontend/tsxReactStandard/references/apiReference.md +3 -0
  600. package/skills/frontend/tsxReactStandard/references/discriminatedUnions.md +31 -0
  601. package/skills/frontend/tsxReactStandard/references/tsconfigStrict.md +36 -0
  602. package/skills/frontend/tsxReactStandard/scripts/validateTsxTypes.py +44 -0
  603. package/skills/gitVersionControl/gitWorkflow/SKILL.md +128 -0
  604. package/skills/gitVersionControl/gitWorkflow/assets/README.md +23 -0
  605. package/skills/gitVersionControl/gitWorkflow/assets/cli/gh-environment.md +87 -0
  606. package/skills/gitVersionControl/gitWorkflow/assets/cli/gh-formatting.md +156 -0
  607. package/skills/gitVersionControl/gitWorkflow/assets/cli/gh-reference.md +2363 -0
  608. package/skills/gitVersionControl/gitWorkflow/assets/using-git/about-git.md +156 -0
  609. package/skills/gitVersionControl/gitWorkflow/assets/using-git/about-remote-repositories.md +65 -0
  610. package/skills/gitVersionControl/gitWorkflow/assets/using-git/associating-text-editors-with-git.md +93 -0
  611. package/skills/gitVersionControl/gitWorkflow/assets/using-git/caching-your-github-credentials.md +115 -0
  612. package/skills/gitVersionControl/gitWorkflow/assets/using-git/getting-changes-from-a-remote-repository.md +76 -0
  613. package/skills/gitVersionControl/gitWorkflow/assets/using-git/ignoring-files.md +51 -0
  614. package/skills/gitVersionControl/gitWorkflow/assets/using-git/managing-remote-repositories.md +231 -0
  615. package/skills/gitVersionControl/gitWorkflow/assets/using-git/pushing-commits-to-a-remote-repository.md +119 -0
  616. package/skills/gitVersionControl/gitWorkflow/evals/evalGitWorkflow.py +43 -0
  617. package/skills/gitVersionControl/gitWorkflow/references/apiReference.md +3 -0
  618. package/skills/gitVersionControl/gitWorkflow/references/branchingModels.md +32 -0
  619. package/skills/gitVersionControl/gitWorkflow/scripts/diagnoseGitGraph.py +68 -0
  620. package/skills/github/assets/README.md +39 -0
  621. package/skills/github/assets/cli/gh-environment.md +87 -0
  622. package/skills/github/assets/cli/gh-formatting.md +156 -0
  623. package/skills/github/assets/cli/gh-reference.md +2363 -0
  624. package/skills/github/assets/docs-api/github-docs-api.md +60 -0
  625. package/skills/github/assets/rest-api/actions-secrets.md +1272 -0
  626. package/skills/github/assets/rest-api/actions-variables.md +1247 -0
  627. package/skills/github/assets/rest-api/actions-workflow-runs.md +1697 -0
  628. package/skills/github/assets/rest-api/actions-workflows.md +348 -0
  629. package/skills/github/assets/rest-api/authenticating.md +174 -0
  630. package/skills/github/assets/rest-api/branches.md +727 -0
  631. package/skills/github/assets/rest-api/checks-runs.md +1013 -0
  632. package/skills/github/assets/rest-api/checks-suites.md +1142 -0
  633. package/skills/github/assets/rest-api/code-scanning.md +2957 -0
  634. package/skills/github/assets/rest-api/collaborators.md +547 -0
  635. package/skills/github/assets/rest-api/commits.md +957 -0
  636. package/skills/github/assets/rest-api/dependabot-alerts.md +895 -0
  637. package/skills/github/assets/rest-api/orgs.md +1172 -0
  638. package/skills/github/assets/rest-api/overview.md +875 -0
  639. package/skills/github/assets/rest-api/pull-reviews.md +722 -0
  640. package/skills/github/assets/rest-api/pulls.md +1605 -0
  641. package/skills/github/assets/rest-api/quickstart.md +344 -0
  642. package/skills/github/assets/rest-api/releases.md +650 -0
  643. package/skills/github/assets/rest-api/repos.md +2957 -0
  644. package/skills/github/assets/rest-api/rules.md +1507 -0
  645. package/skills/github/assets/rest-api/secret-scanning.md +947 -0
  646. package/skills/github/assets/rest-api/teams.md +1690 -0
  647. package/skills/github/githubAction/SKILL.md +159 -0
  648. package/skills/github/githubAction/assets/README.md +38 -0
  649. package/skills/github/githubAction/assets/reference/contexts.md +918 -0
  650. package/skills/github/githubAction/assets/reference/dependency-caching.md +393 -0
  651. package/skills/github/githubAction/assets/reference/events-that-trigger-workflows.md +1348 -0
  652. package/skills/github/githubAction/assets/reference/expressions.md +441 -0
  653. package/skills/github/githubAction/assets/reference/metadata-syntax.md +803 -0
  654. package/skills/github/githubAction/assets/reference/variables.md +149 -0
  655. package/skills/github/githubAction/assets/reference/workflow-cancellation.md +22 -0
  656. package/skills/github/githubAction/assets/reference/workflow-commands.md +1056 -0
  657. package/skills/github/githubAction/assets/reference/workflow-syntax.md +1721 -0
  658. package/skills/github/githubAction/assets/rest-api/secrets.md +1272 -0
  659. package/skills/github/githubAction/assets/rest-api/workflow-runs.md +1697 -0
  660. package/skills/github/githubAction/assets/rest-api/workflows.md +348 -0
  661. package/skills/github/githubAction/assets/starter-workflows/automation/stale.yml +27 -0
  662. package/skills/github/githubAction/assets/starter-workflows/ci/blank.yml +36 -0
  663. package/skills/github/githubAction/assets/starter-workflows/ci/docker-image.yml +18 -0
  664. package/skills/github/githubAction/assets/starter-workflows/ci/go.yml +28 -0
  665. package/skills/github/githubAction/assets/starter-workflows/ci/maven.yml +35 -0
  666. package/skills/github/githubAction/assets/starter-workflows/ci/node.js.yml +31 -0
  667. package/skills/github/githubAction/assets/starter-workflows/ci/python-app.yml +39 -0
  668. package/skills/github/githubAction/assets/starter-workflows/ci/rust.yml +22 -0
  669. package/skills/github/githubAction/assets/starter-workflows/code-scanning/codeql.yml +97 -0
  670. package/skills/github/githubAction/evals/actionVerification.json +14 -0
  671. package/skills/github/githubAction/references/apiReference.md +3 -0
  672. package/skills/github/githubAction/references/workflowPatterns.md +81 -0
  673. package/skills/github/githubAction/scripts/validateWorkflowYaml.py +53 -0
  674. package/skills/github/githubQuality/SKILL.md +136 -0
  675. package/skills/github/githubQuality/assets/README.md +24 -0
  676. package/skills/github/githubQuality/assets/pull-requests/about-code-owners.md +178 -0
  677. package/skills/github/githubQuality/assets/pull-requests/about-merge-methods.md +48 -0
  678. package/skills/github/githubQuality/assets/pull-requests/creating-a-pull-request.md +170 -0
  679. package/skills/github/githubQuality/assets/pull-requests/giving-reviews.md +48 -0
  680. package/skills/github/githubQuality/assets/pull-requests/managing-a-merge-queue.md +134 -0
  681. package/skills/github/githubQuality/assets/pull-requests/merging-a-pull-request.md +101 -0
  682. package/skills/github/githubQuality/assets/pull-requests/resolving-reviews.md +59 -0
  683. package/skills/github/githubQuality/assets/pull-requests/status-checks.md +135 -0
  684. package/skills/github/githubQuality/assets/rest-api/checks-runs.md +1013 -0
  685. package/skills/github/githubQuality/assets/rest-api/checks-suites.md +1142 -0
  686. package/skills/github/githubQuality/assets/rest-api/commits.md +957 -0
  687. package/skills/github/githubQuality/assets/rest-api/pulls.md +1605 -0
  688. package/skills/github/githubQuality/assets/rest-api/reviews.md +722 -0
  689. package/skills/github/githubQuality/evals/qualityVerification.json +14 -0
  690. package/skills/github/githubQuality/references/apiReference.md +3 -0
  691. package/skills/github/githubQuality/references/codeownersExample.md +26 -0
  692. package/skills/github/githubQuality/references/prTemplate.md +20 -0
  693. package/skills/github/githubQuality/scripts/auditPrQuality.py +52 -0
  694. package/skills/github/githubSecurity/SKILL.md +170 -0
  695. package/skills/github/githubSecurity/assets/README.md +32 -0
  696. package/skills/github/githubSecurity/assets/code-scanning/code-scanning-alerts.md +133 -0
  697. package/skills/github/githubSecurity/assets/code-scanning/code-scanning.md +67 -0
  698. package/skills/github/githubSecurity/assets/code-scanning/codeql-code-scanning.md +79 -0
  699. package/skills/github/githubSecurity/assets/code-scanning/configure-code-scanning.md +121 -0
  700. package/skills/github/githubSecurity/assets/dependabot/about-the-dependabot-yml-file.md +74 -0
  701. package/skills/github/githubSecurity/assets/dependabot/dependabot-alerts.md +133 -0
  702. package/skills/github/githubSecurity/assets/dependabot/dependabot-security-updates.md +95 -0
  703. package/skills/github/githubSecurity/assets/dependabot/dependabot-version-updates.md +80 -0
  704. package/skills/github/githubSecurity/assets/rest-api/code-scanning.md +2957 -0
  705. package/skills/github/githubSecurity/assets/rest-api/dependabot-alerts.md +895 -0
  706. package/skills/github/githubSecurity/assets/rest-api/secret-scanning.md +947 -0
  707. package/skills/github/githubSecurity/assets/secret-scanning/enable-secret-scanning.md +59 -0
  708. package/skills/github/githubSecurity/assets/secret-scanning/secret-scanning.md +105 -0
  709. package/skills/github/githubSecurity/assets/security-advisories/github-advisory-database.md +148 -0
  710. package/skills/github/githubSecurity/evals/securityVerification.json +14 -0
  711. package/skills/github/githubSecurity/references/apiReference.md +3 -0
  712. package/skills/github/githubSecurity/references/codeqlAnalysis.yml +42 -0
  713. package/skills/github/githubSecurity/references/dependabotConfig.yml +27 -0
  714. package/skills/github/githubSecurity/scripts/auditRepoSecurity.py +47 -0
  715. package/skills/github/githubSetup/SKILL.md +137 -0
  716. package/skills/github/githubSetup/assets/README.md +40 -0
  717. package/skills/github/githubSetup/assets/branches/about-protected-branches.md +198 -0
  718. package/skills/github/githubSetup/assets/branches/changing-the-default-branch.md +49 -0
  719. package/skills/github/githubSetup/assets/branches/deleting-and-restoring-branches.md +44 -0
  720. package/skills/github/githubSetup/assets/branches/managing-a-branch-protection-rule.md +115 -0
  721. package/skills/github/githubSetup/assets/branches/renaming-a-branch.md +74 -0
  722. package/skills/github/githubSetup/assets/branches/viewing-branches-in-your-repository.md +30 -0
  723. package/skills/github/githubSetup/assets/repositories/about-repositories.md +127 -0
  724. package/skills/github/githubSetup/assets/repositories/cloning-a-repository.md +114 -0
  725. package/skills/github/githubSetup/assets/repositories/creating-a-new-repository.md +82 -0
  726. package/skills/github/githubSetup/assets/repositories/creating-a-repository-from-a-template.md +51 -0
  727. package/skills/github/githubSetup/assets/repositories/deleting-a-repository.md +34 -0
  728. package/skills/github/githubSetup/assets/repositories/managing-teams-and-people-with-access.md +69 -0
  729. package/skills/github/githubSetup/assets/repositories/renaming-a-repository.md +47 -0
  730. package/skills/github/githubSetup/assets/repositories/restoring-a-deleted-repository.md +61 -0
  731. package/skills/github/githubSetup/assets/repositories/setting-repository-visibility.md +137 -0
  732. package/skills/github/githubSetup/assets/rest-api/branches.md +727 -0
  733. package/skills/github/githubSetup/assets/rest-api/quickstart.md +344 -0
  734. package/skills/github/githubSetup/assets/rest-api/repos.md +2957 -0
  735. package/skills/github/githubSetup/assets/rulesets/about-rulesets.md +72 -0
  736. package/skills/github/githubSetup/assets/rulesets/available-rules-for-rulesets.md +383 -0
  737. package/skills/github/githubSetup/assets/rulesets/converting-branch-protections-to-rulesets.md +92 -0
  738. package/skills/github/githubSetup/assets/rulesets/creating-rulesets-for-a-repository.md +108 -0
  739. package/skills/github/githubSetup/assets/rulesets/managing-rulesets-for-a-repository.md +149 -0
  740. package/skills/github/githubSetup/assets/rulesets/troubleshooting-rules.md +122 -0
  741. package/skills/github/githubSetup/evals/setupVerification.json +14 -0
  742. package/skills/github/githubSetup/references/apiReference.md +3 -0
  743. package/skills/github/githubSetup/references/repoSettingsBlueprint.md +13 -0
  744. package/skills/github/githubSetup/references/rulesetTemplates.json +42 -0
  745. package/skills/github/githubSetup/scripts/configureRepoBaseline.py +46 -0
  746. package/skills/github/githubTeam/SKILL.md +115 -0
  747. package/skills/github/githubTeam/assets/README.md +21 -0
  748. package/skills/github/githubTeam/assets/organizations/about-organizations.md +69 -0
  749. package/skills/github/githubTeam/assets/organizations/repository-roles-for-an-organization.md +94 -0
  750. package/skills/github/githubTeam/assets/rest-api/collaborators.md +547 -0
  751. package/skills/github/githubTeam/assets/rest-api/orgs.md +1172 -0
  752. package/skills/github/githubTeam/assets/rest-api/teams.md +1690 -0
  753. package/skills/github/githubTeam/assets/teams/about-teams.md +82 -0
  754. package/skills/github/githubTeam/assets/teams/adding-members-to-a-team.md +55 -0
  755. package/skills/github/githubTeam/evals/teamVerification.json +14 -0
  756. package/skills/github/githubTeam/references/apiReference.md +3 -0
  757. package/skills/github/githubTeam/references/permissionMatrix.md +17 -0
  758. package/skills/github/githubTeam/references/reviewAssignment.md +17 -0
  759. package/skills/github/githubTeam/scripts/manageTeamSync.py +31 -0
  760. package/skills/securityQa/llmSecurityRedteaming/SKILL.md +86 -0
  761. package/skills/securityQa/llmSecurityRedteaming/evals/securityRedteamVerification.json +14 -0
  762. package/skills/securityQa/llmSecurityRedteaming/references/apiReference.md +3 -0
  763. package/skills/securityQa/llmSecurityRedteaming/references/jailbreakTaxonomy.md +6 -0
  764. package/skills/securityQa/llmSecurityRedteaming/references/owaspLlmTopTen.md +12 -0
  765. package/skills/securityQa/llmSecurityRedteaming/scripts/testPromptInjection.py +34 -0
  766. package/skills/softwareDevelopment/requirementsEngineering/SKILL.md +110 -0
  767. package/skills/softwareDevelopment/requirementsEngineering/evals/evalRequirements.py +33 -0
  768. package/skills/softwareDevelopment/requirementsEngineering/references/apiReference.md +3 -0
  769. package/skills/softwareDevelopment/requirementsEngineering/references/requirementsAnalysisModels.md +34 -0
  770. package/skills/softwareDevelopment/requirementsEngineering/scripts/validateUserStories.py +49 -0
  771. package/skills/testing/testDrivenDevelopment/SKILL.md +122 -0
  772. package/skills/testing/testDrivenDevelopment/evals/evalTdd.py +25 -0
  773. package/skills/testing/testDrivenDevelopment/references/apiReference.md +3 -0
  774. package/skills/testing/testDrivenDevelopment/references/testPyramidDoubles.md +35 -0
  775. package/skills/testing/testDrivenDevelopment/scripts/auditTestPyramid.py +58 -0
@@ -0,0 +1,2236 @@
1
+ ---
2
+ title: TanStack Form
3
+ description: Build forms in React using TanStack Form and Zod.
4
+ links:
5
+ doc: https://tanstack.com/form
6
+ ---
7
+
8
+ import { InfoIcon } from "lucide-react"
9
+
10
+ This guide explores how to build forms using TanStack Form. You'll learn to create forms with the `<Field />` component, implement schema validation with Zod, handle errors, and ensure accessibility.
11
+
12
+ ## Demo
13
+
14
+ We'll start by building the following form. It has a simple text input and a textarea. On submit, we'll validate the form data and display any errors.
15
+
16
+ <Callout icon={<InfoIcon />}>
17
+ **Note:** For the purpose of this demo, we have intentionally disabled browser
18
+ validation to show how schema validation and form errors work in TanStack
19
+ Form. It is recommended to add basic browser validation in your production
20
+ code.
21
+ </Callout>
22
+
23
+ ```tsx
24
+ /* eslint-disable react/no-children-prop */
25
+ "use client"
26
+
27
+ import * as React from "react"
28
+ import { useForm } from "@tanstack/react-form"
29
+ import { toast } from "sonner"
30
+ import * as z from "zod"
31
+
32
+ import { Button } from "@/components/ui/button"
33
+ import {
34
+ Card,
35
+ CardContent,
36
+ CardDescription,
37
+ CardFooter,
38
+ CardHeader,
39
+ CardTitle,
40
+ } from "@/components/ui/card"
41
+ import {
42
+ Field,
43
+ FieldDescription,
44
+ FieldError,
45
+ FieldGroup,
46
+ FieldLabel,
47
+ } from "@/components/ui/field"
48
+ import { Input } from "@/components/ui/input"
49
+ import {
50
+ InputGroup,
51
+ InputGroupAddon,
52
+ InputGroupText,
53
+ InputGroupTextarea,
54
+ } from "@/components/ui/input-group"
55
+
56
+ const formSchema = z.object({
57
+ title: z
58
+ .string()
59
+ .min(5, "Bug title must be at least 5 characters.")
60
+ .max(32, "Bug title must be at most 32 characters."),
61
+ description: z
62
+ .string()
63
+ .min(20, "Description must be at least 20 characters.")
64
+ .max(100, "Description must be at most 100 characters."),
65
+ })
66
+
67
+ export function BugReportForm() {
68
+ const form = useForm({
69
+ defaultValues: {
70
+ title: "",
71
+ description: "",
72
+ },
73
+ validators: {
74
+ onSubmit: formSchema,
75
+ },
76
+ onSubmit: async ({ value }) => {
77
+ toast("You submitted the following values:", {
78
+ description: (
79
+ <pre className="mt-2 w-[320px] overflow-x-auto rounded-md bg-code p-4 text-code-foreground">
80
+ <code>{JSON.stringify(value, null, 2)}</code>
81
+ </pre>
82
+ ),
83
+ position: "bottom-right",
84
+ classNames: {
85
+ content: "flex flex-col gap-2",
86
+ },
87
+ style: {
88
+ "--border-radius": "calc(var(--radius) + 4px)",
89
+ } as React.CSSProperties,
90
+ })
91
+ },
92
+ })
93
+
94
+ return (
95
+ <Card className="w-full sm:max-w-md">
96
+ <CardHeader>
97
+ <CardTitle>Bug Report</CardTitle>
98
+ <CardDescription>
99
+ Help us improve by reporting bugs you encounter.
100
+ </CardDescription>
101
+ </CardHeader>
102
+ <CardContent>
103
+ <form
104
+ id="bug-report-form"
105
+ onSubmit={(e) => {
106
+ e.preventDefault()
107
+ form.handleSubmit()
108
+ }}
109
+ >
110
+ <FieldGroup>
111
+ <form.Field
112
+ name="title"
113
+ children={(field) => {
114
+ const isInvalid =
115
+ field.state.meta.isTouched && !field.state.meta.isValid
116
+ return (
117
+ <Field data-invalid={isInvalid}>
118
+ <FieldLabel htmlFor={field.name}>Bug Title</FieldLabel>
119
+ <Input
120
+ id={field.name}
121
+ name={field.name}
122
+ value={field.state.value}
123
+ onBlur={field.handleBlur}
124
+ onChange={(e) => field.handleChange(e.target.value)}
125
+ aria-invalid={isInvalid}
126
+ placeholder="Login button not working on mobile"
127
+ autoComplete="off"
128
+ />
129
+ {isInvalid && (
130
+ <FieldError errors={field.state.meta.errors} />
131
+ )}
132
+ </Field>
133
+ )
134
+ }}
135
+ />
136
+ <form.Field
137
+ name="description"
138
+ children={(field) => {
139
+ const isInvalid =
140
+ field.state.meta.isTouched && !field.state.meta.isValid
141
+ return (
142
+ <Field data-invalid={isInvalid}>
143
+ <FieldLabel htmlFor={field.name}>Description</FieldLabel>
144
+ <InputGroup>
145
+ <InputGroupTextarea
146
+ id={field.name}
147
+ name={field.name}
148
+ value={field.state.value}
149
+ onBlur={field.handleBlur}
150
+ onChange={(e) => field.handleChange(e.target.value)}
151
+ placeholder="I'm having an issue with the login button on mobile."
152
+ rows={6}
153
+ className="min-h-24 resize-none"
154
+ aria-invalid={isInvalid}
155
+ />
156
+ <InputGroupAddon align="block-end">
157
+ <InputGroupText className="tabular-nums">
158
+ {field.state.value.length}/100 characters
159
+ </InputGroupText>
160
+ </InputGroupAddon>
161
+ </InputGroup>
162
+ <FieldDescription>
163
+ Include steps to reproduce, expected behavior, and what
164
+ actually happened.
165
+ </FieldDescription>
166
+ {isInvalid && (
167
+ <FieldError errors={field.state.meta.errors} />
168
+ )}
169
+ </Field>
170
+ )
171
+ }}
172
+ />
173
+ </FieldGroup>
174
+ </form>
175
+ </CardContent>
176
+ <CardFooter>
177
+ <Field orientation="horizontal">
178
+ <Button type="button" variant="outline" onClick={() => form.reset()}>
179
+ Reset
180
+ </Button>
181
+ <Button type="submit" form="bug-report-form">
182
+ Submit
183
+ </Button>
184
+ </Field>
185
+ </CardFooter>
186
+ </Card>
187
+ )
188
+ }
189
+
190
+ ```
191
+
192
+ ## Approach
193
+
194
+ This form leverages TanStack Form for powerful, headless form handling. We'll build our form using the `<Field />` component, which gives you **complete flexibility over the markup and styling**.
195
+
196
+ - Uses TanStack Form's `useForm` hook for form state management.
197
+ - `form.Field` component with render prop pattern for controlled inputs.
198
+ - `<Field />` components for building accessible forms.
199
+ - Client-side validation using Zod.
200
+ - Real-time validation feedback.
201
+
202
+ ## Anatomy
203
+
204
+ Here's a basic example of a form using TanStack Form with the `<Field />` component.
205
+
206
+ ```tsx showLineNumbers {15-31}
207
+ <form
208
+ onSubmit={(e) => {
209
+ e.preventDefault()
210
+ form.handleSubmit()
211
+ }}
212
+ >
213
+ <FieldGroup>
214
+ <form.Field
215
+ name="title"
216
+ children={(field) => {
217
+ const isInvalid =
218
+ field.state.meta.isTouched && !field.state.meta.isValid
219
+ return (
220
+ <Field data-invalid={isInvalid}>
221
+ <FieldLabel htmlFor={field.name}>Bug Title</FieldLabel>
222
+ <Input
223
+ id={field.name}
224
+ name={field.name}
225
+ value={field.state.value}
226
+ onBlur={field.handleBlur}
227
+ onChange={(e) => field.handleChange(e.target.value)}
228
+ aria-invalid={isInvalid}
229
+ placeholder="Login button not working on mobile"
230
+ autoComplete="off"
231
+ />
232
+ <FieldDescription>
233
+ Provide a concise title for your bug report.
234
+ </FieldDescription>
235
+ {isInvalid && <FieldError errors={field.state.meta.errors} />}
236
+ </Field>
237
+ )
238
+ }}
239
+ />
240
+ </FieldGroup>
241
+ <Button type="submit">Submit</Button>
242
+ </form>
243
+ ```
244
+
245
+ ## Form
246
+
247
+ ### Create a schema
248
+
249
+ We'll start by defining the shape of our form using a Zod schema.
250
+
251
+ <Callout icon={<InfoIcon />}>
252
+ **Note:** This example uses `zod v3` for schema validation. TanStack Form
253
+ integrates seamlessly with Zod and other Standard Schema validation libraries
254
+ through its validators API.
255
+ </Callout>
256
+
257
+ ```tsx showLineNumbers title="form.tsx"
258
+ import * as z from "zod"
259
+
260
+ const formSchema = z.object({
261
+ title: z
262
+ .string()
263
+ .min(5, "Bug title must be at least 5 characters.")
264
+ .max(32, "Bug title must be at most 32 characters."),
265
+ description: z
266
+ .string()
267
+ .min(20, "Description must be at least 20 characters.")
268
+ .max(100, "Description must be at most 100 characters."),
269
+ })
270
+ ```
271
+
272
+ ### Set up the form
273
+
274
+ Use the `useForm` hook from TanStack Form to create your form instance with Zod validation.
275
+
276
+ ```tsx showLineNumbers title="form.tsx" {10-21}
277
+ import { useForm } from "@tanstack/react-form"
278
+ import { toast } from "sonner"
279
+ import * as z from "zod"
280
+
281
+ const formSchema = z.object({
282
+ // ...
283
+ })
284
+
285
+ export function BugReportForm() {
286
+ const form = useForm({
287
+ defaultValues: {
288
+ title: "",
289
+ description: "",
290
+ },
291
+ validators: {
292
+ onSubmit: formSchema,
293
+ },
294
+ onSubmit: async ({ value }) => {
295
+ toast.success("Form submitted successfully")
296
+ },
297
+ })
298
+
299
+ return (
300
+ <form
301
+ onSubmit={(e) => {
302
+ e.preventDefault()
303
+ form.handleSubmit()
304
+ }}
305
+ >
306
+ {/* ... */}
307
+ </form>
308
+ )
309
+ }
310
+ ```
311
+
312
+ We are using `onSubmit` to validate the form data here. TanStack Form supports other validation modes, which you can read about in the [documentation](https://tanstack.com/form/latest/docs/framework/react/guides/dynamic-validation).
313
+
314
+ ### Build the form
315
+
316
+ We can now build the form using the `form.Field` component from TanStack Form and the `<Field />` component.
317
+
318
+ <ComponentSource
319
+ src="/registry/new-york-v4/examples/form-tanstack-demo.tsx"
320
+ title="form.tsx"
321
+ />
322
+
323
+ ### Done
324
+
325
+ That's it. You now have a fully accessible form with client-side validation.
326
+
327
+ When you submit the form, the `onSubmit` function will be called with the validated form data. If the form data is invalid, TanStack Form will display the errors next to each field.
328
+
329
+ ## Validation
330
+
331
+ ### Client-side Validation
332
+
333
+ TanStack Form validates your form data using the Zod schema. Validation happens in real-time as the user types.
334
+
335
+ ```tsx showLineNumbers title="form.tsx" {13-15}
336
+ import { useForm } from "@tanstack/react-form"
337
+
338
+ const formSchema = z.object({
339
+ // ...
340
+ })
341
+
342
+ export function BugReportForm() {
343
+ const form = useForm({
344
+ defaultValues: {
345
+ title: "",
346
+ description: "",
347
+ },
348
+ validators: {
349
+ onSubmit: formSchema,
350
+ },
351
+ onSubmit: async ({ value }) => {
352
+ console.log(value)
353
+ },
354
+ })
355
+
356
+ return <form onSubmit={/* ... */}>{/* ... */}</form>
357
+ }
358
+ ```
359
+
360
+ ### Validation Modes
361
+
362
+ TanStack Form supports different validation strategies through the `validators` option:
363
+
364
+ | Mode | Description |
365
+ | ------------ | ------------------------------------ |
366
+ | `"onChange"` | Validation triggers on every change. |
367
+ | `"onBlur"` | Validation triggers on blur. |
368
+ | `"onSubmit"` | Validation triggers on submit. |
369
+
370
+ ```tsx showLineNumbers title="form.tsx" {6-9}
371
+ const form = useForm({
372
+ defaultValues: {
373
+ title: "",
374
+ description: "",
375
+ },
376
+ validators: {
377
+ onSubmit: formSchema,
378
+ onChange: formSchema,
379
+ onBlur: formSchema,
380
+ },
381
+ })
382
+ ```
383
+
384
+ ## Displaying Errors
385
+
386
+ Display errors next to the field using `<FieldError />`. For styling and accessibility:
387
+
388
+ - Add the `data-invalid` prop to the `<Field />` component.
389
+ - Add the `aria-invalid` prop to the form control such as `<Input />`, `<SelectTrigger />`, `<Checkbox />`, etc.
390
+
391
+ ```tsx showLineNumbers title="form.tsx" {4,18}
392
+ <form.Field
393
+ name="email"
394
+ children={(field) => {
395
+ const isInvalid = field.state.meta.isTouched && !field.state.meta.isValid
396
+
397
+ return (
398
+ <Field data-invalid={isInvalid}>
399
+ <FieldLabel htmlFor={field.name}>Email</FieldLabel>
400
+ <Input
401
+ id={field.name}
402
+ name={field.name}
403
+ value={field.state.value}
404
+ onBlur={field.handleBlur}
405
+ onChange={(e) => field.handleChange(e.target.value)}
406
+ type="email"
407
+ aria-invalid={isInvalid}
408
+ />
409
+ {isInvalid && <FieldError errors={field.state.meta.errors} />}
410
+ </Field>
411
+ )
412
+ }}
413
+ />
414
+ ```
415
+
416
+ ## Working with Different Field Types
417
+
418
+ ### Input
419
+
420
+ - For input fields, use `field.state.value` and `field.handleChange` on the `<Input />` component.
421
+ - To show errors, add the `aria-invalid` prop to the `<Input />` component and the `data-invalid` prop to the `<Field />` component.
422
+
423
+ ```tsx
424
+ /* eslint-disable react/no-children-prop */
425
+ "use client"
426
+
427
+ import { useForm } from "@tanstack/react-form"
428
+ import { toast } from "sonner"
429
+ import * as z from "zod"
430
+
431
+ import { Button } from "@/components/ui/button"
432
+ import {
433
+ Card,
434
+ CardContent,
435
+ CardDescription,
436
+ CardFooter,
437
+ CardHeader,
438
+ CardTitle,
439
+ } from "@/components/ui/card"
440
+ import {
441
+ Field,
442
+ FieldDescription,
443
+ FieldError,
444
+ FieldGroup,
445
+ FieldLabel,
446
+ } from "@/components/ui/field"
447
+ import { Input } from "@/components/ui/input"
448
+
449
+ const formSchema = z.object({
450
+ username: z
451
+ .string()
452
+ .min(3, "Username must be at least 3 characters.")
453
+ .max(10, "Username must be at most 10 characters.")
454
+ .regex(
455
+ /^[a-zA-Z0-9_]+$/,
456
+ "Username can only contain letters, numbers, and underscores."
457
+ ),
458
+ })
459
+
460
+ export function FormTanstackInput() {
461
+ const form = useForm({
462
+ defaultValues: {
463
+ username: "",
464
+ },
465
+ validators: {
466
+ onSubmit: formSchema,
467
+ },
468
+ onSubmit: async ({ value }) => {
469
+ toast("You submitted the following values:", {
470
+ description: (
471
+ <pre className="mt-2 w-[320px] overflow-x-auto rounded-md bg-code p-4 text-code-foreground">
472
+ <code>{JSON.stringify(value, null, 2)}</code>
473
+ </pre>
474
+ ),
475
+ position: "bottom-right",
476
+ classNames: {
477
+ content: "flex flex-col gap-2",
478
+ },
479
+ style: {
480
+ "--border-radius": "calc(var(--radius) + 4px)",
481
+ } as React.CSSProperties,
482
+ })
483
+ },
484
+ })
485
+
486
+ return (
487
+ <Card className="w-full sm:max-w-md">
488
+ <CardHeader>
489
+ <CardTitle>Profile Settings</CardTitle>
490
+ <CardDescription>
491
+ Update your profile information below.
492
+ </CardDescription>
493
+ </CardHeader>
494
+ <CardContent>
495
+ <form
496
+ id="form-tanstack-input"
497
+ onSubmit={(e) => {
498
+ e.preventDefault()
499
+ form.handleSubmit()
500
+ }}
501
+ >
502
+ <FieldGroup>
503
+ <form.Field
504
+ name="username"
505
+ children={(field) => {
506
+ const isInvalid =
507
+ field.state.meta.isTouched && !field.state.meta.isValid
508
+ return (
509
+ <Field data-invalid={isInvalid}>
510
+ <FieldLabel htmlFor="form-tanstack-input-username">
511
+ Username
512
+ </FieldLabel>
513
+ <Input
514
+ id="form-tanstack-input-username"
515
+ name={field.name}
516
+ value={field.state.value}
517
+ onBlur={field.handleBlur}
518
+ onChange={(e) => field.handleChange(e.target.value)}
519
+ aria-invalid={isInvalid}
520
+ placeholder="shadcn"
521
+ autoComplete="username"
522
+ />
523
+ <FieldDescription>
524
+ This is your public display name. Must be between 3 and 10
525
+ characters. Must only contain letters, numbers, and
526
+ underscores.
527
+ </FieldDescription>
528
+ {isInvalid && (
529
+ <FieldError errors={field.state.meta.errors} />
530
+ )}
531
+ </Field>
532
+ )
533
+ }}
534
+ />
535
+ </FieldGroup>
536
+ </form>
537
+ </CardContent>
538
+ <CardFooter>
539
+ <Field orientation="horizontal">
540
+ <Button type="button" variant="outline" onClick={() => form.reset()}>
541
+ Reset
542
+ </Button>
543
+ <Button type="submit" form="form-tanstack-input">
544
+ Save
545
+ </Button>
546
+ </Field>
547
+ </CardFooter>
548
+ </Card>
549
+ )
550
+ }
551
+
552
+ ```
553
+
554
+ ```tsx showLineNumbers title="form.tsx" {6,11-14,22}
555
+ <form.Field
556
+ name="username"
557
+ children={(field) => {
558
+ const isInvalid = field.state.meta.isTouched && !field.state.meta.isValid
559
+ return (
560
+ <Field data-invalid={isInvalid}>
561
+ <FieldLabel htmlFor="form-tanstack-input-username">Username</FieldLabel>
562
+ <Input
563
+ id="form-tanstack-input-username"
564
+ name={field.name}
565
+ value={field.state.value}
566
+ onBlur={field.handleBlur}
567
+ onChange={(e) => field.handleChange(e.target.value)}
568
+ aria-invalid={isInvalid}
569
+ placeholder="shadcn"
570
+ autoComplete="username"
571
+ />
572
+ <FieldDescription>
573
+ This is your public display name. Must be between 3 and 10 characters.
574
+ Must only contain letters, numbers, and underscores.
575
+ </FieldDescription>
576
+ {isInvalid && <FieldError errors={field.state.meta.errors} />}
577
+ </Field>
578
+ )
579
+ }}
580
+ />
581
+ ```
582
+
583
+ ### Textarea
584
+
585
+ - For textarea fields, use `field.state.value` and `field.handleChange` on the `<Textarea />` component.
586
+ - To show errors, add the `aria-invalid` prop to the `<Textarea />` component and the `data-invalid` prop to the `<Field />` component.
587
+
588
+ ```tsx
589
+ /* eslint-disable react/no-children-prop */
590
+ "use client"
591
+
592
+ import { useForm } from "@tanstack/react-form"
593
+ import { toast } from "sonner"
594
+ import * as z from "zod"
595
+
596
+ import { Button } from "@/components/ui/button"
597
+ import {
598
+ Card,
599
+ CardContent,
600
+ CardDescription,
601
+ CardFooter,
602
+ CardHeader,
603
+ CardTitle,
604
+ } from "@/components/ui/card"
605
+ import {
606
+ Field,
607
+ FieldDescription,
608
+ FieldError,
609
+ FieldGroup,
610
+ FieldLabel,
611
+ } from "@/components/ui/field"
612
+ import { Textarea } from "@/components/ui/textarea"
613
+
614
+ const formSchema = z.object({
615
+ about: z
616
+ .string()
617
+ .min(10, "Please provide at least 10 characters.")
618
+ .max(200, "Please keep it under 200 characters."),
619
+ })
620
+
621
+ export function FormTanstackTextarea() {
622
+ const form = useForm({
623
+ defaultValues: {
624
+ about: "",
625
+ },
626
+ validators: {
627
+ onSubmit: formSchema,
628
+ },
629
+ onSubmit: async ({ value }) => {
630
+ toast("You submitted the following values:", {
631
+ description: (
632
+ <pre className="mt-2 w-[320px] overflow-x-auto rounded-md bg-code p-4 text-code-foreground">
633
+ <code>{JSON.stringify(value, null, 2)}</code>
634
+ </pre>
635
+ ),
636
+ position: "bottom-right",
637
+ classNames: {
638
+ content: "flex flex-col gap-2",
639
+ },
640
+ style: {
641
+ "--border-radius": "calc(var(--radius) + 4px)",
642
+ } as React.CSSProperties,
643
+ })
644
+ },
645
+ })
646
+
647
+ return (
648
+ <Card className="w-full sm:max-w-md">
649
+ <CardHeader>
650
+ <CardTitle>Personalization</CardTitle>
651
+ <CardDescription>
652
+ Customize your experience by telling us more about yourself.
653
+ </CardDescription>
654
+ </CardHeader>
655
+ <CardContent>
656
+ <form
657
+ id="form-tanstack-textarea"
658
+ onSubmit={(e) => {
659
+ e.preventDefault()
660
+ form.handleSubmit()
661
+ }}
662
+ >
663
+ <FieldGroup>
664
+ <form.Field
665
+ name="about"
666
+ children={(field) => {
667
+ const isInvalid =
668
+ field.state.meta.isTouched && !field.state.meta.isValid
669
+ return (
670
+ <Field data-invalid={isInvalid}>
671
+ <FieldLabel htmlFor="form-tanstack-textarea-about">
672
+ More about you
673
+ </FieldLabel>
674
+ <Textarea
675
+ id="form-tanstack-textarea-about"
676
+ name={field.name}
677
+ value={field.state.value}
678
+ onBlur={field.handleBlur}
679
+ onChange={(e) => field.handleChange(e.target.value)}
680
+ aria-invalid={isInvalid}
681
+ placeholder="I'm a software engineer..."
682
+ className="min-h-[120px]"
683
+ />
684
+ <FieldDescription>
685
+ Tell us more about yourself. This will be used to help us
686
+ personalize your experience.
687
+ </FieldDescription>
688
+ {isInvalid && (
689
+ <FieldError errors={field.state.meta.errors} />
690
+ )}
691
+ </Field>
692
+ )
693
+ }}
694
+ />
695
+ </FieldGroup>
696
+ </form>
697
+ </CardContent>
698
+ <CardFooter>
699
+ <Field orientation="horizontal">
700
+ <Button type="button" variant="outline" onClick={() => form.reset()}>
701
+ Reset
702
+ </Button>
703
+ <Button type="submit" form="form-tanstack-textarea">
704
+ Save
705
+ </Button>
706
+ </Field>
707
+ </CardFooter>
708
+ </Card>
709
+ )
710
+ }
711
+
712
+ ```
713
+
714
+ ```tsx showLineNumbers title="form.tsx" {6,13-16,24}
715
+ <form.Field
716
+ name="about"
717
+ children={(field) => {
718
+ const isInvalid = field.state.meta.isTouched && !field.state.meta.isValid
719
+ return (
720
+ <Field data-invalid={isInvalid}>
721
+ <FieldLabel htmlFor="form-tanstack-textarea-about">
722
+ More about you
723
+ </FieldLabel>
724
+ <Textarea
725
+ id="form-tanstack-textarea-about"
726
+ name={field.name}
727
+ value={field.state.value}
728
+ onBlur={field.handleBlur}
729
+ onChange={(e) => field.handleChange(e.target.value)}
730
+ aria-invalid={isInvalid}
731
+ placeholder="I'm a software engineer..."
732
+ className="min-h-[120px]"
733
+ />
734
+ <FieldDescription>
735
+ Tell us more about yourself. This will be used to help us personalize
736
+ your experience.
737
+ </FieldDescription>
738
+ {isInvalid && <FieldError errors={field.state.meta.errors} />}
739
+ </Field>
740
+ )
741
+ }}
742
+ />
743
+ ```
744
+
745
+ ### Select
746
+
747
+ - For select components, use `field.state.value` and `field.handleChange` on the `<Select />` component.
748
+ - To show errors, add the `aria-invalid` prop to the `<SelectTrigger />` component and the `data-invalid` prop to the `<Field />` component.
749
+
750
+ ```tsx
751
+ /* eslint-disable react/no-children-prop */
752
+ "use client"
753
+
754
+ import { useForm } from "@tanstack/react-form"
755
+ import { toast } from "sonner"
756
+ import * as z from "zod"
757
+
758
+ import { Button } from "@/components/ui/button"
759
+ import {
760
+ Card,
761
+ CardContent,
762
+ CardDescription,
763
+ CardFooter,
764
+ CardHeader,
765
+ CardTitle,
766
+ } from "@/components/ui/card"
767
+ import {
768
+ Field,
769
+ FieldContent,
770
+ FieldDescription,
771
+ FieldError,
772
+ FieldGroup,
773
+ FieldLabel,
774
+ } from "@/components/ui/field"
775
+ import {
776
+ Select,
777
+ SelectContent,
778
+ SelectItem,
779
+ SelectSeparator,
780
+ SelectTrigger,
781
+ SelectValue,
782
+ } from "@/components/ui/select"
783
+
784
+ const spokenLanguages = [
785
+ { label: "English", value: "en" },
786
+ { label: "Spanish", value: "es" },
787
+ { label: "French", value: "fr" },
788
+ { label: "German", value: "de" },
789
+ { label: "Italian", value: "it" },
790
+ { label: "Chinese", value: "zh" },
791
+ { label: "Japanese", value: "ja" },
792
+ ] as const
793
+
794
+ const formSchema = z.object({
795
+ language: z
796
+ .string()
797
+ .min(1, "Please select your spoken language.")
798
+ .refine((val) => val !== "auto", {
799
+ message:
800
+ "Auto-detection is not allowed. Please select a specific language.",
801
+ }),
802
+ })
803
+
804
+ export function FormTanstackSelect() {
805
+ const form = useForm({
806
+ defaultValues: {
807
+ language: "",
808
+ },
809
+ validators: {
810
+ onSubmit: formSchema,
811
+ },
812
+ onSubmit: async ({ value }) => {
813
+ toast("You submitted the following values:", {
814
+ description: (
815
+ <pre className="mt-2 w-[320px] overflow-x-auto rounded-md bg-code p-4 text-code-foreground">
816
+ <code>{JSON.stringify(value, null, 2)}</code>
817
+ </pre>
818
+ ),
819
+ position: "bottom-right",
820
+ classNames: {
821
+ content: "flex flex-col gap-2",
822
+ },
823
+ style: {
824
+ "--border-radius": "calc(var(--radius) + 4px)",
825
+ } as React.CSSProperties,
826
+ })
827
+ },
828
+ })
829
+
830
+ return (
831
+ <Card className="w-full sm:max-w-lg">
832
+ <CardHeader>
833
+ <CardTitle>Language Preferences</CardTitle>
834
+ <CardDescription>
835
+ Select your preferred spoken language.
836
+ </CardDescription>
837
+ </CardHeader>
838
+ <CardContent>
839
+ <form
840
+ id="form-tanstack-select"
841
+ onSubmit={(e) => {
842
+ e.preventDefault()
843
+ form.handleSubmit()
844
+ }}
845
+ >
846
+ <FieldGroup>
847
+ <form.Field
848
+ name="language"
849
+ children={(field) => {
850
+ const isInvalid =
851
+ field.state.meta.isTouched && !field.state.meta.isValid
852
+ return (
853
+ <Field orientation="responsive" data-invalid={isInvalid}>
854
+ <FieldContent>
855
+ <FieldLabel htmlFor="form-tanstack-select-language">
856
+ Spoken Language
857
+ </FieldLabel>
858
+ <FieldDescription>
859
+ For best results, select the language you speak.
860
+ </FieldDescription>
861
+ {isInvalid && (
862
+ <FieldError errors={field.state.meta.errors} />
863
+ )}
864
+ </FieldContent>
865
+ <Select
866
+ name={field.name}
867
+ value={field.state.value}
868
+ onValueChange={field.handleChange}
869
+ >
870
+ <SelectTrigger
871
+ id="form-tanstack-select-language"
872
+ aria-invalid={isInvalid}
873
+ className="min-w-[120px]"
874
+ >
875
+ <SelectValue placeholder="Select" />
876
+ </SelectTrigger>
877
+ <SelectContent position="item-aligned">
878
+ <SelectItem value="auto">Auto</SelectItem>
879
+ <SelectSeparator />
880
+ {spokenLanguages.map((language) => (
881
+ <SelectItem
882
+ key={language.value}
883
+ value={language.value}
884
+ >
885
+ {language.label}
886
+ </SelectItem>
887
+ ))}
888
+ </SelectContent>
889
+ </Select>
890
+ </Field>
891
+ )
892
+ }}
893
+ />
894
+ </FieldGroup>
895
+ </form>
896
+ </CardContent>
897
+ <CardFooter>
898
+ <Field orientation="horizontal">
899
+ <Button type="button" variant="outline" onClick={() => form.reset()}>
900
+ Reset
901
+ </Button>
902
+ <Button type="submit" form="form-tanstack-select">
903
+ Save
904
+ </Button>
905
+ </Field>
906
+ </CardFooter>
907
+ </Card>
908
+ )
909
+ }
910
+
911
+ ```
912
+
913
+ ```tsx showLineNumbers title="form.tsx" {6,18-19,23}
914
+ <form.Field
915
+ name="language"
916
+ children={(field) => {
917
+ const isInvalid = field.state.meta.isTouched && !field.state.meta.isValid
918
+ return (
919
+ <Field orientation="responsive" data-invalid={isInvalid}>
920
+ <FieldContent>
921
+ <FieldLabel htmlFor="form-tanstack-select-language">
922
+ Spoken Language
923
+ </FieldLabel>
924
+ <FieldDescription>
925
+ For best results, select the language you speak.
926
+ </FieldDescription>
927
+ {isInvalid && <FieldError errors={field.state.meta.errors} />}
928
+ </FieldContent>
929
+ <Select
930
+ name={field.name}
931
+ value={field.state.value}
932
+ onValueChange={field.handleChange}
933
+ >
934
+ <SelectTrigger
935
+ id="form-tanstack-select-language"
936
+ aria-invalid={isInvalid}
937
+ className="min-w-[120px]"
938
+ >
939
+ <SelectValue placeholder="Select" />
940
+ </SelectTrigger>
941
+ <SelectContent position="item-aligned">
942
+ <SelectItem value="auto">Auto</SelectItem>
943
+ <SelectItem value="en">English</SelectItem>
944
+ </SelectContent>
945
+ </Select>
946
+ </Field>
947
+ )
948
+ }}
949
+ />
950
+ ```
951
+
952
+ ### Checkbox
953
+
954
+ - For checkbox, use `field.state.value` and `field.handleChange` on the `<Checkbox />` component.
955
+ - To show errors, add the `aria-invalid` prop to the `<Checkbox />` component and the `data-invalid` prop to the `<Field />` component.
956
+ - For checkbox arrays, use `mode="array"` on the `<form.Field />` component and TanStack Form's array helpers.
957
+ - Remember to add `data-slot="checkbox-group"` to the `<FieldGroup />` component for proper styling and spacing.
958
+
959
+ ```tsx
960
+ /* eslint-disable react/no-children-prop */
961
+ "use client"
962
+
963
+ import { useForm } from "@tanstack/react-form"
964
+ import { toast } from "sonner"
965
+ import * as z from "zod"
966
+
967
+ import { Button } from "@/components/ui/button"
968
+ import {
969
+ Card,
970
+ CardContent,
971
+ CardDescription,
972
+ CardFooter,
973
+ CardHeader,
974
+ CardTitle,
975
+ } from "@/components/ui/card"
976
+ import { Checkbox } from "@/components/ui/checkbox"
977
+ import {
978
+ Field,
979
+ FieldDescription,
980
+ FieldError,
981
+ FieldGroup,
982
+ FieldLabel,
983
+ FieldLegend,
984
+ FieldSeparator,
985
+ FieldSet,
986
+ } from "@/components/ui/field"
987
+
988
+ const tasks = [
989
+ {
990
+ id: "push",
991
+ label: "Push notifications",
992
+ },
993
+ {
994
+ id: "email",
995
+ label: "Email notifications",
996
+ },
997
+ ] as const
998
+
999
+ const formSchema = z.object({
1000
+ responses: z.boolean(),
1001
+ tasks: z
1002
+ .array(z.string())
1003
+ .min(1, "Please select at least one notification type.")
1004
+ .refine(
1005
+ (value) => value.every((task) => tasks.some((t) => t.id === task)),
1006
+ {
1007
+ message: "Invalid notification type selected.",
1008
+ }
1009
+ ),
1010
+ })
1011
+
1012
+ export function FormTanstackCheckbox() {
1013
+ const form = useForm({
1014
+ defaultValues: {
1015
+ responses: true,
1016
+ tasks: [] as string[],
1017
+ },
1018
+ validators: {
1019
+ onSubmit: formSchema,
1020
+ },
1021
+ onSubmit: async ({ value }) => {
1022
+ toast("You submitted the following values:", {
1023
+ description: (
1024
+ <pre className="mt-2 w-[320px] overflow-x-auto rounded-md bg-code p-4 text-code-foreground">
1025
+ <code>{JSON.stringify(value, null, 2)}</code>
1026
+ </pre>
1027
+ ),
1028
+ position: "bottom-right",
1029
+ classNames: {
1030
+ content: "flex flex-col gap-2",
1031
+ },
1032
+ style: {
1033
+ "--border-radius": "calc(var(--radius) + 4px)",
1034
+ } as React.CSSProperties,
1035
+ })
1036
+ },
1037
+ })
1038
+
1039
+ return (
1040
+ <Card className="w-full sm:max-w-md">
1041
+ <CardHeader>
1042
+ <CardTitle>Notifications</CardTitle>
1043
+ <CardDescription>Manage your notification preferences.</CardDescription>
1044
+ </CardHeader>
1045
+ <CardContent>
1046
+ <form
1047
+ id="form-tanstack-checkbox"
1048
+ onSubmit={(e) => {
1049
+ e.preventDefault()
1050
+ form.handleSubmit()
1051
+ }}
1052
+ >
1053
+ <FieldGroup>
1054
+ <form.Field
1055
+ name="responses"
1056
+ children={(field) => {
1057
+ const isInvalid =
1058
+ field.state.meta.isTouched && !field.state.meta.isValid
1059
+ return (
1060
+ <div>
1061
+ <FieldSet>
1062
+ <FieldLegend variant="label">Responses</FieldLegend>
1063
+ <FieldDescription>
1064
+ Get notified for requests that take time, like research
1065
+ or image generation.
1066
+ </FieldDescription>
1067
+ <FieldGroup data-slot="checkbox-group">
1068
+ <Field
1069
+ orientation="horizontal"
1070
+ data-invalid={isInvalid}
1071
+ >
1072
+ <Checkbox
1073
+ id="form-tanstack-checkbox-responses"
1074
+ name={field.name}
1075
+ checked={field.state.value}
1076
+ onCheckedChange={(checked) =>
1077
+ field.handleChange(checked === true)
1078
+ }
1079
+ disabled
1080
+ />
1081
+ <FieldLabel
1082
+ htmlFor="form-tanstack-checkbox-responses"
1083
+ className="font-normal"
1084
+ >
1085
+ Push notifications
1086
+ </FieldLabel>
1087
+ </Field>
1088
+ </FieldGroup>
1089
+ </FieldSet>
1090
+ {isInvalid && (
1091
+ <FieldError errors={field.state.meta.errors} />
1092
+ )}
1093
+ </div>
1094
+ )
1095
+ }}
1096
+ />
1097
+ <FieldSeparator />
1098
+ <form.Field
1099
+ name="tasks"
1100
+ mode="array"
1101
+ children={(field) => {
1102
+ const isInvalid =
1103
+ field.state.meta.isTouched && !field.state.meta.isValid
1104
+ return (
1105
+ <FieldGroup>
1106
+ <FieldSet data-invalid={isInvalid}>
1107
+ <FieldLegend variant="label">Tasks</FieldLegend>
1108
+ <FieldDescription>
1109
+ Get notified when tasks you&apos;ve created have
1110
+ updates.
1111
+ </FieldDescription>
1112
+ <FieldGroup data-slot="checkbox-group">
1113
+ {tasks.map((task) => (
1114
+ <Field
1115
+ key={task.id}
1116
+ orientation="horizontal"
1117
+ data-invalid={isInvalid}
1118
+ >
1119
+ <Checkbox
1120
+ id={`form-tanstack-checkbox-${task.id}`}
1121
+ name={field.name}
1122
+ aria-invalid={isInvalid}
1123
+ checked={field.state.value.includes(task.id)}
1124
+ onCheckedChange={(checked) => {
1125
+ if (checked) {
1126
+ field.pushValue(task.id)
1127
+ } else {
1128
+ const index = field.state.value.indexOf(
1129
+ task.id
1130
+ )
1131
+ if (index > -1) {
1132
+ field.removeValue(index)
1133
+ }
1134
+ }
1135
+ }}
1136
+ />
1137
+ <FieldLabel
1138
+ htmlFor={`form-tanstack-checkbox-${task.id}`}
1139
+ className="font-normal"
1140
+ >
1141
+ {task.label}
1142
+ </FieldLabel>
1143
+ </Field>
1144
+ ))}
1145
+ </FieldGroup>
1146
+ </FieldSet>
1147
+ {isInvalid && (
1148
+ <FieldError errors={field.state.meta.errors} />
1149
+ )}
1150
+ </FieldGroup>
1151
+ )
1152
+ }}
1153
+ />
1154
+ </FieldGroup>
1155
+ </form>
1156
+ </CardContent>
1157
+ <CardFooter>
1158
+ <Field orientation="horizontal">
1159
+ <Button type="button" variant="outline" onClick={() => form.reset()}>
1160
+ Reset
1161
+ </Button>
1162
+ <Button type="submit" form="form-tanstack-checkbox">
1163
+ Save
1164
+ </Button>
1165
+ </Field>
1166
+ </CardFooter>
1167
+ </Card>
1168
+ )
1169
+ }
1170
+
1171
+ ```
1172
+
1173
+ ```tsx showLineNumbers title="form.tsx" {12,17,22-24,44}
1174
+ <form.Field
1175
+ name="tasks"
1176
+ mode="array"
1177
+ children={(field) => {
1178
+ const isInvalid = field.state.meta.isTouched && !field.state.meta.isValid
1179
+ return (
1180
+ <FieldSet>
1181
+ <FieldLegend variant="label">Tasks</FieldLegend>
1182
+ <FieldDescription>
1183
+ Get notified when tasks you&apos;ve created have updates.
1184
+ </FieldDescription>
1185
+ <FieldGroup data-slot="checkbox-group">
1186
+ {tasks.map((task) => (
1187
+ <Field
1188
+ key={task.id}
1189
+ orientation="horizontal"
1190
+ data-invalid={isInvalid}
1191
+ >
1192
+ <Checkbox
1193
+ id={`form-tanstack-checkbox-${task.id}`}
1194
+ name={field.name}
1195
+ aria-invalid={isInvalid}
1196
+ checked={field.state.value.includes(task.id)}
1197
+ onCheckedChange={(checked) => {
1198
+ if (checked) {
1199
+ field.pushValue(task.id)
1200
+ } else {
1201
+ const index = field.state.value.indexOf(task.id)
1202
+ if (index > -1) {
1203
+ field.removeValue(index)
1204
+ }
1205
+ }
1206
+ }}
1207
+ />
1208
+ <FieldLabel
1209
+ htmlFor={`form-tanstack-checkbox-${task.id}`}
1210
+ className="font-normal"
1211
+ >
1212
+ {task.label}
1213
+ </FieldLabel>
1214
+ </Field>
1215
+ ))}
1216
+ </FieldGroup>
1217
+ {isInvalid && <FieldError errors={field.state.meta.errors} />}
1218
+ </FieldSet>
1219
+ )
1220
+ }}
1221
+ />
1222
+ ```
1223
+
1224
+ ### Radio Group
1225
+
1226
+ - For radio groups, use `field.state.value` and `field.handleChange` on the `<RadioGroup />` component.
1227
+ - To show errors, add the `aria-invalid` prop to the `<RadioGroupItem />` component and the `data-invalid` prop to the `<Field />` component.
1228
+
1229
+ ```tsx
1230
+ /* eslint-disable react/no-children-prop */
1231
+ "use client"
1232
+
1233
+ import { useForm } from "@tanstack/react-form"
1234
+ import { toast } from "sonner"
1235
+ import * as z from "zod"
1236
+
1237
+ import { Button } from "@/components/ui/button"
1238
+ import {
1239
+ Card,
1240
+ CardContent,
1241
+ CardDescription,
1242
+ CardFooter,
1243
+ CardHeader,
1244
+ CardTitle,
1245
+ } from "@/components/ui/card"
1246
+ import {
1247
+ Field,
1248
+ FieldContent,
1249
+ FieldDescription,
1250
+ FieldError,
1251
+ FieldGroup,
1252
+ FieldLabel,
1253
+ FieldLegend,
1254
+ FieldSet,
1255
+ FieldTitle,
1256
+ } from "@/components/ui/field"
1257
+ import {
1258
+ RadioGroup,
1259
+ RadioGroupItem,
1260
+ } from "@/components/ui/radio-group"
1261
+
1262
+ const plans = [
1263
+ {
1264
+ id: "starter",
1265
+ title: "Starter (100K tokens/month)",
1266
+ description: "For everyday use with basic features.",
1267
+ },
1268
+ {
1269
+ id: "pro",
1270
+ title: "Pro (1M tokens/month)",
1271
+ description: "For advanced AI usage with more features.",
1272
+ },
1273
+ {
1274
+ id: "enterprise",
1275
+ title: "Enterprise (Unlimited tokens)",
1276
+ description: "For large teams and heavy usage.",
1277
+ },
1278
+ ] as const
1279
+
1280
+ const formSchema = z.object({
1281
+ plan: z.string().min(1, "You must select a subscription plan to continue."),
1282
+ })
1283
+
1284
+ export function FormTanstackRadioGroup() {
1285
+ const form = useForm({
1286
+ defaultValues: {
1287
+ plan: "",
1288
+ },
1289
+ validators: {
1290
+ onSubmit: formSchema,
1291
+ },
1292
+ onSubmit: async ({ value }) => {
1293
+ toast("You submitted the following values:", {
1294
+ description: (
1295
+ <pre className="mt-2 w-[320px] overflow-x-auto rounded-md bg-code p-4 text-code-foreground">
1296
+ <code>{JSON.stringify(value, null, 2)}</code>
1297
+ </pre>
1298
+ ),
1299
+ position: "bottom-right",
1300
+ classNames: {
1301
+ content: "flex flex-col gap-2",
1302
+ },
1303
+ style: {
1304
+ "--border-radius": "calc(var(--radius) + 4px)",
1305
+ } as React.CSSProperties,
1306
+ })
1307
+ },
1308
+ })
1309
+
1310
+ return (
1311
+ <Card className="w-full sm:max-w-md">
1312
+ <CardHeader>
1313
+ <CardTitle>Subscription Plan</CardTitle>
1314
+ <CardDescription>
1315
+ See pricing and features for each plan.
1316
+ </CardDescription>
1317
+ </CardHeader>
1318
+ <CardContent>
1319
+ <form
1320
+ id="form-tanstack-radiogroup"
1321
+ onSubmit={(e) => {
1322
+ e.preventDefault()
1323
+ form.handleSubmit()
1324
+ }}
1325
+ >
1326
+ <FieldGroup>
1327
+ <form.Field
1328
+ name="plan"
1329
+ children={(field) => {
1330
+ const isInvalid =
1331
+ field.state.meta.isTouched && !field.state.meta.isValid
1332
+ return (
1333
+ <FieldSet>
1334
+ <FieldLegend>Plan</FieldLegend>
1335
+ <FieldDescription>
1336
+ You can upgrade or downgrade your plan at any time.
1337
+ </FieldDescription>
1338
+ <RadioGroup
1339
+ name={field.name}
1340
+ value={field.state.value}
1341
+ onValueChange={field.handleChange}
1342
+ >
1343
+ {plans.map((plan) => (
1344
+ <FieldLabel
1345
+ key={plan.id}
1346
+ htmlFor={`form-tanstack-radiogroup-${plan.id}`}
1347
+ >
1348
+ <Field
1349
+ orientation="horizontal"
1350
+ data-invalid={isInvalid}
1351
+ >
1352
+ <FieldContent>
1353
+ <FieldTitle>{plan.title}</FieldTitle>
1354
+ <FieldDescription>
1355
+ {plan.description}
1356
+ </FieldDescription>
1357
+ </FieldContent>
1358
+ <RadioGroupItem
1359
+ value={plan.id}
1360
+ id={`form-tanstack-radiogroup-${plan.id}`}
1361
+ aria-invalid={isInvalid}
1362
+ />
1363
+ </Field>
1364
+ </FieldLabel>
1365
+ ))}
1366
+ </RadioGroup>
1367
+ {isInvalid && (
1368
+ <FieldError errors={field.state.meta.errors} />
1369
+ )}
1370
+ </FieldSet>
1371
+ )
1372
+ }}
1373
+ />
1374
+ </FieldGroup>
1375
+ </form>
1376
+ </CardContent>
1377
+ <CardFooter>
1378
+ <Field orientation="horizontal">
1379
+ <Button type="button" variant="outline" onClick={() => form.reset()}>
1380
+ Reset
1381
+ </Button>
1382
+ <Button type="submit" form="form-tanstack-radiogroup">
1383
+ Save
1384
+ </Button>
1385
+ </Field>
1386
+ </CardFooter>
1387
+ </Card>
1388
+ )
1389
+ }
1390
+
1391
+ ```
1392
+
1393
+ ```tsx showLineNumbers title="form.tsx" {21,29,35}
1394
+ <form.Field
1395
+ name="plan"
1396
+ children={(field) => {
1397
+ const isInvalid = field.state.meta.isTouched && !field.state.meta.isValid
1398
+ return (
1399
+ <FieldSet>
1400
+ <FieldLegend>Plan</FieldLegend>
1401
+ <FieldDescription>
1402
+ You can upgrade or downgrade your plan at any time.
1403
+ </FieldDescription>
1404
+ <RadioGroup
1405
+ name={field.name}
1406
+ value={field.state.value}
1407
+ onValueChange={field.handleChange}
1408
+ >
1409
+ {plans.map((plan) => (
1410
+ <FieldLabel
1411
+ key={plan.id}
1412
+ htmlFor={`form-tanstack-radiogroup-${plan.id}`}
1413
+ >
1414
+ <Field orientation="horizontal" data-invalid={isInvalid}>
1415
+ <FieldContent>
1416
+ <FieldTitle>{plan.title}</FieldTitle>
1417
+ <FieldDescription>{plan.description}</FieldDescription>
1418
+ </FieldContent>
1419
+ <RadioGroupItem
1420
+ value={plan.id}
1421
+ id={`form-tanstack-radiogroup-${plan.id}`}
1422
+ aria-invalid={isInvalid}
1423
+ />
1424
+ </Field>
1425
+ </FieldLabel>
1426
+ ))}
1427
+ </RadioGroup>
1428
+ {isInvalid && <FieldError errors={field.state.meta.errors} />}
1429
+ </FieldSet>
1430
+ )
1431
+ }}
1432
+ />
1433
+ ```
1434
+
1435
+ ### Switch
1436
+
1437
+ - For switches, use `field.state.value` and `field.handleChange` on the `<Switch />` component.
1438
+ - To show errors, add the `aria-invalid` prop to the `<Switch />` component and the `data-invalid` prop to the `<Field />` component.
1439
+
1440
+ ```tsx
1441
+ /* eslint-disable react/no-children-prop */
1442
+ "use client"
1443
+
1444
+ import { useForm } from "@tanstack/react-form"
1445
+ import { toast } from "sonner"
1446
+ import * as z from "zod"
1447
+
1448
+ import { Button } from "@/components/ui/button"
1449
+ import {
1450
+ Card,
1451
+ CardContent,
1452
+ CardDescription,
1453
+ CardFooter,
1454
+ CardHeader,
1455
+ CardTitle,
1456
+ } from "@/components/ui/card"
1457
+ import {
1458
+ Field,
1459
+ FieldContent,
1460
+ FieldDescription,
1461
+ FieldError,
1462
+ FieldGroup,
1463
+ FieldLabel,
1464
+ } from "@/components/ui/field"
1465
+ import { Switch } from "@/components/ui/switch"
1466
+
1467
+ const formSchema = z.object({
1468
+ twoFactor: z.boolean().refine((val) => val === true, {
1469
+ message: "It is highly recommended to enable two-factor authentication.",
1470
+ }),
1471
+ })
1472
+
1473
+ export function FormTanstackSwitch() {
1474
+ const form = useForm({
1475
+ defaultValues: {
1476
+ twoFactor: false,
1477
+ },
1478
+ validators: {
1479
+ onSubmit: formSchema,
1480
+ },
1481
+ onSubmit: async ({ value }) => {
1482
+ toast("You submitted the following values:", {
1483
+ description: (
1484
+ <pre className="mt-2 w-[320px] overflow-x-auto rounded-md bg-code p-4 text-code-foreground">
1485
+ <code>{JSON.stringify(value, null, 2)}</code>
1486
+ </pre>
1487
+ ),
1488
+ position: "bottom-right",
1489
+ classNames: {
1490
+ content: "flex flex-col gap-2",
1491
+ },
1492
+ style: {
1493
+ "--border-radius": "calc(var(--radius) + 4px)",
1494
+ } as React.CSSProperties,
1495
+ })
1496
+ },
1497
+ })
1498
+
1499
+ return (
1500
+ <Card className="w-full sm:max-w-md">
1501
+ <CardHeader>
1502
+ <CardTitle>Security Settings</CardTitle>
1503
+ <CardDescription>
1504
+ Manage your account security preferences.
1505
+ </CardDescription>
1506
+ </CardHeader>
1507
+ <CardContent>
1508
+ <form
1509
+ id="form-tanstack-switch"
1510
+ onSubmit={(e) => {
1511
+ e.preventDefault()
1512
+ form.handleSubmit()
1513
+ }}
1514
+ >
1515
+ <FieldGroup>
1516
+ <form.Field
1517
+ name="twoFactor"
1518
+ children={(field) => {
1519
+ const isInvalid =
1520
+ field.state.meta.isTouched && !field.state.meta.isValid
1521
+ return (
1522
+ <Field orientation="horizontal" data-invalid={isInvalid}>
1523
+ <FieldContent>
1524
+ <FieldLabel htmlFor="form-tanstack-switch-twoFactor">
1525
+ Multi-factor authentication
1526
+ </FieldLabel>
1527
+ <FieldDescription>
1528
+ Enable multi-factor authentication to secure your
1529
+ account.
1530
+ </FieldDescription>
1531
+ {isInvalid && (
1532
+ <FieldError errors={field.state.meta.errors} />
1533
+ )}
1534
+ </FieldContent>
1535
+ <Switch
1536
+ id="form-tanstack-switch-twoFactor"
1537
+ name={field.name}
1538
+ checked={field.state.value}
1539
+ onCheckedChange={field.handleChange}
1540
+ aria-invalid={isInvalid}
1541
+ />
1542
+ </Field>
1543
+ )
1544
+ }}
1545
+ />
1546
+ </FieldGroup>
1547
+ </form>
1548
+ </CardContent>
1549
+ <CardFooter>
1550
+ <Field orientation="horizontal">
1551
+ <Button type="button" variant="outline" onClick={() => form.reset()}>
1552
+ Reset
1553
+ </Button>
1554
+ <Button type="submit" form="form-tanstack-switch">
1555
+ Save
1556
+ </Button>
1557
+ </Field>
1558
+ </CardFooter>
1559
+ </Card>
1560
+ )
1561
+ }
1562
+
1563
+ ```
1564
+
1565
+ ```tsx showLineNumbers title="form.tsx" {6,14,19-21}
1566
+ <form.Field
1567
+ name="twoFactor"
1568
+ children={(field) => {
1569
+ const isInvalid = field.state.meta.isTouched && !field.state.meta.isValid
1570
+ return (
1571
+ <Field orientation="horizontal" data-invalid={isInvalid}>
1572
+ <FieldContent>
1573
+ <FieldLabel htmlFor="form-tanstack-switch-twoFactor">
1574
+ Multi-factor authentication
1575
+ </FieldLabel>
1576
+ <FieldDescription>
1577
+ Enable multi-factor authentication to secure your account.
1578
+ </FieldDescription>
1579
+ {isInvalid && <FieldError errors={field.state.meta.errors} />}
1580
+ </FieldContent>
1581
+ <Switch
1582
+ id="form-tanstack-switch-twoFactor"
1583
+ name={field.name}
1584
+ checked={field.state.value}
1585
+ onCheckedChange={field.handleChange}
1586
+ aria-invalid={isInvalid}
1587
+ />
1588
+ </Field>
1589
+ )
1590
+ }}
1591
+ />
1592
+ ```
1593
+
1594
+ ### Complex Forms
1595
+
1596
+ Here is an example of a more complex form with multiple fields and validation.
1597
+
1598
+ ```tsx
1599
+ /* eslint-disable react/no-children-prop */
1600
+ "use client"
1601
+
1602
+ import * as React from "react"
1603
+ import { useForm } from "@tanstack/react-form"
1604
+ import { toast } from "sonner"
1605
+ import * as z from "zod"
1606
+
1607
+ import { Button } from "@/components/ui/button"
1608
+ import { Card, CardContent, CardFooter } from "@/components/ui/card"
1609
+ import { Checkbox } from "@/components/ui/checkbox"
1610
+ import {
1611
+ Field,
1612
+ FieldContent,
1613
+ FieldDescription,
1614
+ FieldError,
1615
+ FieldGroup,
1616
+ FieldLabel,
1617
+ FieldLegend,
1618
+ FieldSeparator,
1619
+ FieldSet,
1620
+ FieldTitle,
1621
+ } from "@/components/ui/field"
1622
+ import {
1623
+ RadioGroup,
1624
+ RadioGroupItem,
1625
+ } from "@/components/ui/radio-group"
1626
+ import {
1627
+ Select,
1628
+ SelectContent,
1629
+ SelectItem,
1630
+ SelectTrigger,
1631
+ SelectValue,
1632
+ } from "@/components/ui/select"
1633
+ import { Switch } from "@/components/ui/switch"
1634
+
1635
+ const addons = [
1636
+ {
1637
+ id: "analytics",
1638
+ title: "Analytics",
1639
+ description: "Advanced analytics and reporting",
1640
+ },
1641
+ {
1642
+ id: "backup",
1643
+ title: "Backup",
1644
+ description: "Automated daily backups",
1645
+ },
1646
+ {
1647
+ id: "support",
1648
+ title: "Priority Support",
1649
+ description: "24/7 premium customer support",
1650
+ },
1651
+ ] as const
1652
+
1653
+ const formSchema = z.object({
1654
+ plan: z
1655
+ .string({
1656
+ required_error: "Please select a subscription plan",
1657
+ })
1658
+ .min(1, "Please select a subscription plan")
1659
+ .refine((value) => value === "basic" || value === "pro", {
1660
+ message: "Invalid plan selection. Please choose Basic or Pro",
1661
+ }),
1662
+ billingPeriod: z
1663
+ .string({
1664
+ required_error: "Please select a billing period",
1665
+ })
1666
+ .min(1, "Please select a billing period"),
1667
+ addons: z
1668
+ .array(z.string())
1669
+ .min(1, "Please select at least one add-on")
1670
+ .max(3, "You can select up to 3 add-ons")
1671
+ .refine(
1672
+ (value) => value.every((addon) => addons.some((a) => a.id === addon)),
1673
+ {
1674
+ message: "You selected an invalid add-on",
1675
+ }
1676
+ ),
1677
+ emailNotifications: z.boolean(),
1678
+ })
1679
+
1680
+ export function FormTanstackComplex() {
1681
+ const form = useForm({
1682
+ defaultValues: {
1683
+ plan: "basic",
1684
+ billingPeriod: "monthly",
1685
+ addons: [] as string[],
1686
+ emailNotifications: false,
1687
+ },
1688
+ validators: {
1689
+ onSubmit: formSchema,
1690
+ },
1691
+ onSubmit: async ({ value }) => {
1692
+ toast("You submitted the following values:", {
1693
+ description: (
1694
+ <pre className="mt-2 w-[320px] overflow-x-auto rounded-md bg-code p-4 text-code-foreground">
1695
+ <code>{JSON.stringify(value, null, 2)}</code>
1696
+ </pre>
1697
+ ),
1698
+ position: "bottom-right",
1699
+ classNames: {
1700
+ content: "flex flex-col gap-2",
1701
+ },
1702
+ style: {
1703
+ "--border-radius": "calc(var(--radius) + 4px)",
1704
+ } as React.CSSProperties,
1705
+ })
1706
+ },
1707
+ })
1708
+
1709
+ return (
1710
+ <Card className="w-full max-w-sm">
1711
+ <CardContent>
1712
+ <form
1713
+ id="subscription-form"
1714
+ onSubmit={(e) => {
1715
+ e.preventDefault()
1716
+ form.handleSubmit()
1717
+ }}
1718
+ >
1719
+ <FieldGroup>
1720
+ <form.Field
1721
+ name="plan"
1722
+ children={(field) => {
1723
+ const isInvalid =
1724
+ field.state.meta.isTouched && !field.state.meta.isValid
1725
+ return (
1726
+ <FieldSet>
1727
+ <FieldLegend>Subscription Plan</FieldLegend>
1728
+ <FieldDescription>
1729
+ Choose your subscription plan.
1730
+ </FieldDescription>
1731
+ <RadioGroup
1732
+ name={field.name}
1733
+ value={field.state.value}
1734
+ onValueChange={field.handleChange}
1735
+ >
1736
+ <FieldLabel htmlFor="basic">
1737
+ <Field
1738
+ orientation="horizontal"
1739
+ data-invalid={isInvalid}
1740
+ >
1741
+ <FieldContent>
1742
+ <FieldTitle>Basic</FieldTitle>
1743
+ <FieldDescription>
1744
+ For individuals and small teams
1745
+ </FieldDescription>
1746
+ </FieldContent>
1747
+ <RadioGroupItem
1748
+ value="basic"
1749
+ id="basic"
1750
+ aria-invalid={isInvalid}
1751
+ />
1752
+ </Field>
1753
+ </FieldLabel>
1754
+ <FieldLabel htmlFor="pro">
1755
+ <Field
1756
+ orientation="horizontal"
1757
+ data-invalid={isInvalid}
1758
+ >
1759
+ <FieldContent>
1760
+ <FieldTitle>Pro</FieldTitle>
1761
+ <FieldDescription>
1762
+ For businesses with higher demands
1763
+ </FieldDescription>
1764
+ </FieldContent>
1765
+ <RadioGroupItem
1766
+ value="pro"
1767
+ id="pro"
1768
+ aria-invalid={isInvalid}
1769
+ />
1770
+ </Field>
1771
+ </FieldLabel>
1772
+ </RadioGroup>
1773
+ {isInvalid && (
1774
+ <FieldError errors={field.state.meta.errors} />
1775
+ )}
1776
+ </FieldSet>
1777
+ )
1778
+ }}
1779
+ />
1780
+ <FieldSeparator />
1781
+ <form.Field
1782
+ name="billingPeriod"
1783
+ children={(field) => {
1784
+ const isInvalid =
1785
+ field.state.meta.isTouched && !field.state.meta.isValid
1786
+ return (
1787
+ <Field data-invalid={isInvalid}>
1788
+ <FieldLabel htmlFor={field.name}>Billing Period</FieldLabel>
1789
+ <Select
1790
+ name={field.name}
1791
+ value={field.state.value}
1792
+ onValueChange={field.handleChange}
1793
+ aria-invalid={isInvalid}
1794
+ >
1795
+ <SelectTrigger id={field.name}>
1796
+ <SelectValue placeholder="Select" />
1797
+ </SelectTrigger>
1798
+ <SelectContent>
1799
+ <SelectItem value="monthly">Monthly</SelectItem>
1800
+ <SelectItem value="yearly">Yearly</SelectItem>
1801
+ </SelectContent>
1802
+ </Select>
1803
+ <FieldDescription>
1804
+ Choose how often you want to be billed.
1805
+ </FieldDescription>
1806
+ {isInvalid && (
1807
+ <FieldError errors={field.state.meta.errors} />
1808
+ )}
1809
+ </Field>
1810
+ )
1811
+ }}
1812
+ />
1813
+ <FieldSeparator />
1814
+ <form.Field
1815
+ name="addons"
1816
+ mode="array"
1817
+ children={(field) => {
1818
+ const isInvalid =
1819
+ field.state.meta.isTouched && !field.state.meta.isValid
1820
+ return (
1821
+ <FieldSet>
1822
+ <FieldLegend>Add-ons</FieldLegend>
1823
+ <FieldDescription>
1824
+ Select additional features you&apos;d like to include.
1825
+ </FieldDescription>
1826
+ <FieldGroup data-slot="checkbox-group">
1827
+ {addons.map((addon) => (
1828
+ <Field
1829
+ key={addon.id}
1830
+ orientation="horizontal"
1831
+ data-invalid={isInvalid}
1832
+ >
1833
+ <Checkbox
1834
+ id={addon.id}
1835
+ name={field.name}
1836
+ aria-invalid={isInvalid}
1837
+ checked={field.state.value.includes(addon.id)}
1838
+ onCheckedChange={(checked) => {
1839
+ if (checked) {
1840
+ field.pushValue(addon.id)
1841
+ } else {
1842
+ const index = field.state.value.indexOf(
1843
+ addon.id
1844
+ )
1845
+ if (index > -1) {
1846
+ field.removeValue(index)
1847
+ }
1848
+ }
1849
+ }}
1850
+ />
1851
+ <FieldContent>
1852
+ <FieldLabel htmlFor={addon.id}>
1853
+ {addon.title}
1854
+ </FieldLabel>
1855
+ <FieldDescription>
1856
+ {addon.description}
1857
+ </FieldDescription>
1858
+ </FieldContent>
1859
+ </Field>
1860
+ ))}
1861
+ </FieldGroup>
1862
+ {isInvalid && (
1863
+ <FieldError errors={field.state.meta.errors} />
1864
+ )}
1865
+ </FieldSet>
1866
+ )
1867
+ }}
1868
+ />
1869
+ <FieldSeparator />
1870
+ <form.Field
1871
+ name="emailNotifications"
1872
+ children={(field) => {
1873
+ const isInvalid =
1874
+ field.state.meta.isTouched && !field.state.meta.isValid
1875
+ return (
1876
+ <Field orientation="horizontal" data-invalid={isInvalid}>
1877
+ <FieldContent>
1878
+ <FieldLabel htmlFor={field.name}>
1879
+ Email Notifications
1880
+ </FieldLabel>
1881
+ <FieldDescription>
1882
+ Receive email updates about your subscription
1883
+ </FieldDescription>
1884
+ </FieldContent>
1885
+ <Switch
1886
+ id={field.name}
1887
+ name={field.name}
1888
+ checked={field.state.value}
1889
+ onCheckedChange={field.handleChange}
1890
+ aria-invalid={isInvalid}
1891
+ />
1892
+ {isInvalid && (
1893
+ <FieldError errors={field.state.meta.errors} />
1894
+ )}
1895
+ </Field>
1896
+ )
1897
+ }}
1898
+ />
1899
+ </FieldGroup>
1900
+ </form>
1901
+ </CardContent>
1902
+ <CardFooter>
1903
+ <Field orientation="horizontal" className="justify-end">
1904
+ <Button type="submit" form="subscription-form">
1905
+ Save Preferences
1906
+ </Button>
1907
+ </Field>
1908
+ </CardFooter>
1909
+ </Card>
1910
+ )
1911
+ }
1912
+
1913
+ ```
1914
+
1915
+ ## Resetting the Form
1916
+
1917
+ Use `form.reset()` to reset the form to its default values.
1918
+
1919
+ ```tsx showLineNumbers
1920
+ <Button type="button" variant="outline" onClick={() => form.reset()}>
1921
+ Reset
1922
+ </Button>
1923
+ ```
1924
+
1925
+ ## Array Fields
1926
+
1927
+ TanStack Form provides powerful array field management with `mode="array"`. This allows you to dynamically add, remove, and update array items with full validation support.
1928
+
1929
+ ```tsx
1930
+ /* eslint-disable react/no-children-prop */
1931
+ "use client"
1932
+
1933
+ import * as React from "react"
1934
+ import { useForm } from "@tanstack/react-form"
1935
+ import { XIcon } from "lucide-react"
1936
+ import { toast } from "sonner"
1937
+ import { z } from "zod"
1938
+
1939
+ import { Button } from "@/components/ui/button"
1940
+ import {
1941
+ Card,
1942
+ CardContent,
1943
+ CardDescription,
1944
+ CardFooter,
1945
+ CardHeader,
1946
+ CardTitle,
1947
+ } from "@/components/ui/card"
1948
+ import {
1949
+ Field,
1950
+ FieldContent,
1951
+ FieldDescription,
1952
+ FieldError,
1953
+ FieldGroup,
1954
+ FieldLegend,
1955
+ FieldSet,
1956
+ } from "@/components/ui/field"
1957
+ import {
1958
+ InputGroup,
1959
+ InputGroupAddon,
1960
+ InputGroupButton,
1961
+ InputGroupInput,
1962
+ } from "@/components/ui/input-group"
1963
+
1964
+ const formSchema = z.object({
1965
+ emails: z
1966
+ .array(
1967
+ z.object({
1968
+ address: z.string().email("Enter a valid email address."),
1969
+ })
1970
+ )
1971
+ .min(1, "Add at least one email address.")
1972
+ .max(5, "You can add up to 5 email addresses."),
1973
+ })
1974
+
1975
+ export function FormTanstackArray() {
1976
+ const form = useForm({
1977
+ defaultValues: {
1978
+ emails: [{ address: "" }],
1979
+ },
1980
+ validators: {
1981
+ onBlur: formSchema,
1982
+ },
1983
+ onSubmit: async ({ value }) => {
1984
+ toast("You submitted the following values:", {
1985
+ description: (
1986
+ <pre className="mt-2 w-[320px] overflow-x-auto rounded-md bg-code p-4 text-code-foreground">
1987
+ <code>{JSON.stringify(value, null, 2)}</code>
1988
+ </pre>
1989
+ ),
1990
+ position: "bottom-right",
1991
+ classNames: {
1992
+ content: "flex flex-col gap-2",
1993
+ },
1994
+ style: {
1995
+ "--border-radius": "calc(var(--radius) + 4px)",
1996
+ } as React.CSSProperties,
1997
+ })
1998
+ },
1999
+ })
2000
+
2001
+ return (
2002
+ <Card className="w-full sm:max-w-md">
2003
+ <CardHeader className="border-b">
2004
+ <CardTitle>Contact Emails</CardTitle>
2005
+ <CardDescription>Manage your contact email addresses.</CardDescription>
2006
+ </CardHeader>
2007
+ <CardContent>
2008
+ <form
2009
+ id="form-tanstack-array"
2010
+ onSubmit={(e) => {
2011
+ e.preventDefault()
2012
+ form.handleSubmit()
2013
+ }}
2014
+ >
2015
+ <form.Field name="emails" mode="array">
2016
+ {(field) => {
2017
+ const isInvalid =
2018
+ field.state.meta.isTouched && !field.state.meta.isValid
2019
+ return (
2020
+ <FieldSet className="gap-4">
2021
+ <FieldLegend variant="label">Email Addresses</FieldLegend>
2022
+ <FieldDescription>
2023
+ Add up to 5 email addresses where we can contact you.
2024
+ </FieldDescription>
2025
+ <FieldGroup className="gap-4">
2026
+ {field.state.value.map((_, index) => (
2027
+ <form.Field
2028
+ key={index}
2029
+ name={`emails[${index}].address`}
2030
+ children={(subField) => {
2031
+ const isSubFieldInvalid =
2032
+ subField.state.meta.isTouched &&
2033
+ !subField.state.meta.isValid
2034
+ return (
2035
+ <Field
2036
+ orientation="horizontal"
2037
+ data-invalid={isSubFieldInvalid}
2038
+ >
2039
+ <FieldContent>
2040
+ <InputGroup>
2041
+ <InputGroupInput
2042
+ id={`form-tanstack-array-email-${index}`}
2043
+ name={subField.name}
2044
+ value={subField.state.value}
2045
+ onBlur={subField.handleBlur}
2046
+ onChange={(e) =>
2047
+ subField.handleChange(e.target.value)
2048
+ }
2049
+ aria-invalid={isSubFieldInvalid}
2050
+ placeholder="name@example.com"
2051
+ type="email"
2052
+ autoComplete="email"
2053
+ />
2054
+ {field.state.value.length > 1 && (
2055
+ <InputGroupAddon align="inline-end">
2056
+ <InputGroupButton
2057
+ type="button"
2058
+ variant="ghost"
2059
+ size="icon-xs"
2060
+ onClick={() => field.removeValue(index)}
2061
+ aria-label={`Remove email ${index + 1}`}
2062
+ >
2063
+ <XIcon />
2064
+ </InputGroupButton>
2065
+ </InputGroupAddon>
2066
+ )}
2067
+ </InputGroup>
2068
+ {isSubFieldInvalid && (
2069
+ <FieldError
2070
+ errors={subField.state.meta.errors}
2071
+ />
2072
+ )}
2073
+ </FieldContent>
2074
+ </Field>
2075
+ )
2076
+ }}
2077
+ />
2078
+ ))}
2079
+ <Button
2080
+ type="button"
2081
+ variant="outline"
2082
+ size="sm"
2083
+ onClick={() => field.pushValue({ address: "" })}
2084
+ disabled={field.state.value.length >= 5}
2085
+ >
2086
+ Add Email Address
2087
+ </Button>
2088
+ </FieldGroup>
2089
+ {isInvalid && <FieldError errors={field.state.meta.errors} />}
2090
+ </FieldSet>
2091
+ )
2092
+ }}
2093
+ </form.Field>
2094
+ </form>
2095
+ </CardContent>
2096
+ <CardFooter className="border-t">
2097
+ <Field orientation="horizontal">
2098
+ <Button type="button" variant="outline" onClick={() => form.reset()}>
2099
+ Reset
2100
+ </Button>
2101
+ <Button type="submit" form="form-tanstack-array">
2102
+ Save
2103
+ </Button>
2104
+ </Field>
2105
+ </CardFooter>
2106
+ </Card>
2107
+ )
2108
+ }
2109
+
2110
+ ```
2111
+
2112
+ This example demonstrates managing multiple email addresses with array fields. Users can add up to 5 email addresses, remove individual addresses, and each address is validated independently.
2113
+
2114
+ ### Array Field Structure
2115
+
2116
+ Use `mode="array"` on the parent field to enable array field management.
2117
+
2118
+ ```tsx showLineNumbers title="form.tsx" {3,12-14}
2119
+ <form.Field
2120
+ name="emails"
2121
+ mode="array"
2122
+ children={(field) => {
2123
+ return (
2124
+ <FieldSet>
2125
+ <FieldLegend variant="label">Email Addresses</FieldLegend>
2126
+ <FieldDescription>
2127
+ Add up to 5 email addresses where we can contact you.
2128
+ </FieldDescription>
2129
+ <FieldGroup>
2130
+ {field.state.value.map((_, index) => (
2131
+ // Nested field for each array item
2132
+ ))}
2133
+ </FieldGroup>
2134
+ </FieldSet>
2135
+ )
2136
+ }}
2137
+ />
2138
+ ```
2139
+
2140
+ ### Nested Fields
2141
+
2142
+ Access individual array items using bracket notation: `fieldName[index].propertyName`. This example uses `InputGroup` to display the remove button inline with the input.
2143
+
2144
+ ```tsx showLineNumbers title="form.tsx"
2145
+ <form.Field
2146
+ name={`emails[${index}].address`}
2147
+ children={(subField) => {
2148
+ const isSubFieldInvalid =
2149
+ subField.state.meta.isTouched && !subField.state.meta.isValid
2150
+ return (
2151
+ <Field orientation="horizontal" data-invalid={isSubFieldInvalid}>
2152
+ <FieldContent>
2153
+ <InputGroup>
2154
+ <InputGroupInput
2155
+ id={`form-tanstack-array-email-${index}`}
2156
+ name={subField.name}
2157
+ value={subField.state.value}
2158
+ onBlur={subField.handleBlur}
2159
+ onChange={(e) => subField.handleChange(e.target.value)}
2160
+ aria-invalid={isSubFieldInvalid}
2161
+ placeholder="name@example.com"
2162
+ type="email"
2163
+ />
2164
+ {field.state.value.length > 1 && (
2165
+ <InputGroupAddon align="inline-end">
2166
+ <InputGroupButton
2167
+ type="button"
2168
+ variant="ghost"
2169
+ size="icon-xs"
2170
+ onClick={() => field.removeValue(index)}
2171
+ aria-label={`Remove email ${index + 1}`}
2172
+ >
2173
+ <XIcon />
2174
+ </InputGroupButton>
2175
+ </InputGroupAddon>
2176
+ )}
2177
+ </InputGroup>
2178
+ {isSubFieldInvalid && (
2179
+ <FieldError errors={subField.state.meta.errors} />
2180
+ )}
2181
+ </FieldContent>
2182
+ </Field>
2183
+ )
2184
+ }}
2185
+ />
2186
+ ```
2187
+
2188
+ ### Adding Items
2189
+
2190
+ Use `field.pushValue(item)` to add items to an array field. You can disable the button when the array reaches its maximum length.
2191
+
2192
+ ```tsx showLineNumbers title="form.tsx"
2193
+ <Button
2194
+ type="button"
2195
+ variant="outline"
2196
+ size="sm"
2197
+ onClick={() => field.pushValue({ address: "" })}
2198
+ disabled={field.state.value.length >= 5}
2199
+ >
2200
+ Add Email Address
2201
+ </Button>
2202
+ ```
2203
+
2204
+ ### Removing Items
2205
+
2206
+ Use `field.removeValue(index)` to remove items from an array field. You can conditionally show the remove button only when there's more than one item.
2207
+
2208
+ ```tsx showLineNumbers title="form.tsx"
2209
+ {
2210
+ field.state.value.length > 1 && (
2211
+ <InputGroupButton
2212
+ onClick={() => field.removeValue(index)}
2213
+ aria-label={`Remove email ${index + 1}`}
2214
+ >
2215
+ <XIcon />
2216
+ </InputGroupButton>
2217
+ )
2218
+ }
2219
+ ```
2220
+
2221
+ ### Array Validation
2222
+
2223
+ Validate array fields using Zod's array methods.
2224
+
2225
+ ```tsx showLineNumbers title="form.tsx"
2226
+ const formSchema = z.object({
2227
+ emails: z
2228
+ .array(
2229
+ z.object({
2230
+ address: z.string().email("Enter a valid email address."),
2231
+ })
2232
+ )
2233
+ .min(1, "Add at least one email address.")
2234
+ .max(5, "You can add up to 5 email addresses."),
2235
+ })
2236
+ ```