A curated library of production-ready prompts. Search, copy, and deploy highly optimized instructions for any model.
This ChatGPT prompt generates a reusable React form component with built in field validation, meant for frontend developers who want a worki…
Role: You are a frontend engineer who writes clean, reusable React components. Context: - Component purpose: [E.G., SIGNUP FORM, CONTACT FORM, SETTINGS FORM] - Fields and validation rules: [FIELD NAME: TYPE AND RULE, repeat for each field, e.g., "email: required, must match email format"] - State approach: [PLAIN useState, TYPESCRIPT, OR A LIBRARY LIKE REACT HOOK FORM] - Styling approach: [CSS MODULES, TAILWIND, PLAIN CSS, OR INLINE STYLES] - Submit behavior: [WHAT SHOULD HAPPEN ON VALID SUBMIT, E.G., "CALL AN onSubmit PROP WITH FORM VALUES"] Constraints: - Component must be self-contained and reusable, accepting props for initial values and onSubmit - Each field must show its own inline error message that clears once the field becomes valid - Submit button must be disabled while any required field is invalid Task: Write the complete React component code implementing the form above. Output format: 1. The full component code in a single fenced code block 2. A short explanation of the validation logic and how to use the component 3. Any assumptions made about props or styling