@@ -22,6 +22,7 @@ The `FormError` component provides standardized form-level error handling, compl
2222import { FormError } from '@lambdacurry/forms';
2323
2424// Basic usage - looks for errors._form by default
25+ // Typically placed below inputs and above submit button
2526<FormError />
2627
2728// Custom error key
@@ -136,9 +137,6 @@ const LoginForm = () => {
136137 <fetcher.Form onSubmit={methods.handleSubmit} className="max-w-md mx-auto p-6 space-y-4">
137138 <h2 className="text-xl font-semibold text-gray-900">Sign In</h2>
138139
139- {/* Form-level error display */}
140- <FormError className="mb-4" />
141-
142140 <TextField
143141 name="email"
144142 type="email"
@@ -155,6 +153,9 @@ const LoginForm = () => {
155153 disabled={isSubmitting}
156154 />
157155
156+ {/* Form-level error display - typically placed below inputs and above submit button */}
157+ <FormError className="mb-4" />
158+
158159 <Button type="submit" disabled={isSubmitting} className="w-full">
159160 {isSubmitting ? 'Signing In...' : 'Sign In'}
160161 </Button>
@@ -993,6 +994,9 @@ const ComprehensiveForm = () => {
993994
994995 {/* Submit Button & Status */}
995996 <div className="pt-6">
997+ {/* Form-level error display - below inputs, above submit button */}
998+ <FormError className="mb-4" />
999+
9961000 <Button
9971001 type="submit"
9981002 disabled={isSubmitting}
@@ -1007,13 +1011,6 @@ const ComprehensiveForm = () => {
10071011 <p className="text-green-700 font-medium">{fetcher.data.message}</p>
10081012 </div>
10091013 )}
1010-
1011- {/* General Error */}
1012- {fetcher.data?.errors?._form && (
1013- <div className="mt-4 p-4 bg-red-50 border border-red-200 rounded-md">
1014- <p className="text-red-700 font-medium">{fetcher.data.errors._form.message}</p>
1015- </div>
1016- )}
10171014 </div>
10181015 </fetcher.Form>
10191016 </RemixFormProvider>
@@ -1144,14 +1141,14 @@ This comprehensive example serves as a complete reference for implementing any f
11441141
114511427. **FormError Placement Options**
11461143 ```typescript
1147- // Top of form (most common)
1144+ // Below inputs, above submit button (most common)
11481145 <FormError className="mb-4" />
11491146
11501147 // Between sections
11511148 <FormError className="my-4 text-center" />
11521149
1153- // Bottom of form
1154- <FormError className="mt -4" />
1150+ // Top of form (for critical errors that need immediate attention)
1151+ <FormError className="mb -4" />
11551152
11561153 // Multiple placements with different styling
11571154 <FormError className="mb-4 p-3 bg-red-50 rounded" />
@@ -1212,9 +1209,10 @@ This comprehensive example serves as a complete reference for implementing any f
12121209- **Be user-friendly**: Avoid technical jargon and error codes
12131210
12141211### 3. Placement Strategy
1215- - **Top placement**: For critical errors that should be seen immediately
1212+ - **Below inputs, above submit button**: Most common placement - users see errors after completing form fields but before submitting
1213+ - **Top placement**: For critical errors that need immediate attention before users start filling the form
12161214- **Inline placement**: For contextual errors related to specific sections
1217- - **Bottom placement **: For summary or less critical errors
1215+ - **Multiple placements **: FormError can be placed anywhere in the form and styled differently for various use cases
12181216
12191217### 4. Component Integration
12201218- FormError works seamlessly with all existing form components
0 commit comments