# Chapitre 3 : Formulaires ## Form Le composant `Form` gère la soumission et la validation des formulaires. ### Syntaxe de base ```javascript import { Form, Input, Button } from '@cap-rel/smartcommon'; function ContactForm() { const handleSubmit = (values) => { console.log(values); // { name: 'Jean', email: 'jean@example.com' } }; return (
); } ``` ### Avec valeurs initiales ```javascript function EditProductForm({ product }) { const handleSubmit = async (values) => { await api.private.put(`products/${product.id}`, { json: values }); }; return (
); } ``` ## Input Champ de saisie texte polyvalent. ### Props principales ^ Prop ^ Type ^ Description ^ | name | string | Nom du champ (obligatoire) | | label | string | Libellé affiché | | type | string | 'text', 'email', 'password', 'number', 'tel' | | placeholder | string | Texte indicatif | | required | boolean | Champ obligatoire | | disabled | boolean | Champ désactivé | | error | string | Message d'erreur | ### Exemples ```javascript // Texte simple // Email avec validation // Mot de passe // Nombre // Téléphone // Avec placeholder // Désactivé ``` ## Textarea Zone de texte multiligne. ```javascript import { Textarea } from '@cap-rel/smartcommon';