Form Patterns â
Complete form examples and best practices for user input.
đ Common Form Patterns â
Single Page Form â
All fields on one page, suitable for short forms.
Use when:
- Form has < 10 fields
- All fields are related
- Quick completion is important
Multi-Step Form â
Complex forms broken into multiple steps.
Use when:
- Form has many fields (10+)
- Logical groupings exist
- User needs to see progress
- Each step has distinct purpose
Example Structure:
Step 1: Basic Information
Step 2: Service Details
Step 3: Schedule & Preferences
Step 4: Review & ConfirmInline Editing â
Edit content directly in place without a traditional form.
Use when:
- Editing single values
- User needs quick updates
- Context is important
đ¯ Form Validation â
Real-time Validation â
Validate as the user types or on blur.
Best for:
- Username availability
- Password strength
- Email format
- Required fields
On Submit Validation â
Validate when form is submitted.
Best for:
- Complex validation rules
- Server-side checks
- Complete form validation
Validation Message Patterns â
Error Messages â
â Email is required
â Password must be at least 8 characters
â This username is already takenSuccess Messages â
â Email is available
â Password strength: StrongHelper Text â
âšī¸ Use at least 8 characters, including letters and numbers
âšī¸ We'll send a confirmation to this emailđ Field Patterns â
Required vs Optional â
- Mark required fields with asterisk (*)
- Or mark optional fields with "(optional)"
- Be consistent throughout
Input Masking â
Format input as user types:
- Phone: (555) 123-4567
- Date: MM/DD/YYYY
- Credit Card: 1234 5678 9012 3456
Auto-complete & Suggestions â
- Use browser autocomplete attributes
- Provide suggestions for common inputs
- Allow selection from dropdown
Conditional Fields â
Show/hide fields based on user input:
âī¸ Schedule recurring service
âââ [Frequency dropdown appears]
âââ [Date selector appears]đ¨ Form Layout Patterns â
Vertical Form (Recommended) â
[Label]
[Input field_________________]
[Helper text]
[Label]
[Input field_________________]
[Helper text]
[Submit Button]Horizontal Form â
[Label] [Input field________] [Helper text]
[Label] [Input field________] [Helper text]
[Submit Button]Grid Form â
[Label] [Label]
[Input field____] [Input field____]
[Label] [Label]
[Input field____] [Input field____]đą Mobile Form Patterns â
Mobile Considerations â
- Use appropriate input types (tel, email, number)
- Large touch targets (44x44px minimum)
- Reduce typing with selects and pickers
- Use native mobile keyboards
- Sticky action buttons at bottom
Input Types â
html
<input type="email" /> <!-- Email keyboard -->
<input type="tel" /> <!-- Phone keyboard -->
<input type="number" /> <!-- Numeric keyboard -->
<input type="date" /> <!-- Date picker -->
<input type="url" /> <!-- URL keyboard -->âŋ Accessibility â
Form Accessibility Checklist â
- [ ] Labels associated with inputs
- [ ] Error messages linked to fields
- [ ] Required fields indicated
- [ ] Keyboard navigable
- [ ] Focus indicators visible
- [ ] Submit button clearly labeled
- [ ] Error summary at top of form
Proper Markup â
html
<form>
<div class="form-field">
<label for="email">
Email Address *
</label>
<input
type="email"
id="email"
name="email"
required
aria-required="true"
aria-describedby="email-helper email-error"
/>
<p id="email-helper" class="helper-text">
We'll never share your email
</p>
<p id="email-error" class="error-text" role="alert">
<!-- Error message when invalid -->
</p>
</div>
<button type="submit">Submit</button>
</form>đ Common Form Examples â
Contact Form â
[Name]
[Email]
[Phone]
[Message (textarea)]
[Submit]Service Booking Form â
Step 1: Service Selection
[Service Type dropdown]
[Property Size]
[Add-ons checkboxes]
Step 2: Schedule
[Date Picker]
[Time Slot]
[Frequency]
Step 3: Contact Info
[Name]
[Email]
[Phone]
[Address]
Step 4: Review & Payment
[Summary]
[Payment Info]
[Submit]Login Form â
[Email]
[Password]
[âī¸ Remember me] [Forgot password?]
[Login Button]Signup Form â
[Full Name]
[Email]
[Password]
[Confirm Password]
[âī¸ I agree to Terms]
[Sign Up Button]
Already have an account? [Login]đ Auto-generated Section â
Note: To add form pattern screenshots:
- Export form examples from Figma
- Run
npm run docs:update-form-patterns- Visual examples will be added
Related: