add-form
Skill3 starsChanged 3 days agoMITView on GitHub
Créer un formulaire avec validation (contact, inscription, newsletter, paramètres). À utiliser dès qu'un formulaire a plus d'un champ ou des règles de validation.
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- felipemenezes098/ui-flxtheir own version, first seen Oct 15, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- felipemenezes098/ui-flx★ 47same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-componentSkill
- add-motionSkill
- add-pageSkill
- add-testSkill
- deploySkill
- design-systemSkill
- fetch-dataSkill
- from-figmaSkill
- polish-uiSkill
- rebrandSkill
The file
Files
Ajouter un formulaire
Pour un champ unique sans règle (une recherche), un simple useState suffit. Au-delà, utiliser react-hook-form et zod.
1. Installer (la première fois)
npm install react-hook-form zod @hookform/resolvers
npx shadcn@latest add label2. Modèle
import { useForm } from 'react-hook-form'
import { zodResolver } from '@hookform/resolvers/zod'
import { z } from 'zod'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { Textarea } from '@/components/ui/textarea'
const schema = z.object({
email: z.email('Adresse e-mail invalide'),
message: z.string().min(10, 'Au moins 10 caractères'),
})
type Values = z.infer<typeof schema>
export function ContactForm() {
const {
register,
handleSubmit,
reset,
formState: { errors, isSubmitting, isSubmitSuccessful },
} = useForm<Values>({ resolver: zodResolver(schema) })
async function onSubmit(values: Values) {
// Envoyer les données ici (API, service de formulaires…)
console.log(values)
reset()
}
return (
<form onSubmit={handleSubmit(onSubmit)} noValidate className="grid gap-5">
<div className="grid gap-2">
<Label htmlFor="email">E-mail</Label>
<Input
id="email"
type="email"
aria-invalid={!!errors.email}
{...register('email')}
/>
{errors.email && (
<p className="text-sm text-destructive">{errors.email.message}</p>
)}
</div>
<div className="grid gap-2">
<Label htmlFor="message">Message</Label>
<Textarea
id="message"
aria-invalid={!!errors.message}
{...register('message')}
/>
{errors.message && (
<p className="text-sm text-destructive">{errors.message.message}</p>
)}
</div>
<Button
type="submit"
disabled={isSubmitting}
className="justify-self-start"
>
{isSubmitting ? 'Envoi…' : 'Envoyer'}
</Button>
{isSubmitSuccessful && (
<p className="text-sm text-muted-foreground">Merci, message envoyé !</p>
)}
</form>
)
}Règles
- Chaque champ a un
<Label>relié parhtmlFor/id. aria-invalidsur un champ en erreur : les composantsui/affichent alors la bordure rouge tout seuls.- Messages d'erreur courts, en français, sous le champ.
- Le site est statique : pour recevoir les messages sans serveur, utiliser un service de formulaires (Formspree, Web3Forms…) ou une fonction serverless.
- Ajouter un test (skill
add-test) qui vérifie l'affichage d'une erreur et l'envoi valide.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

