# Microinteraction Case Studies Detailed design breakdowns of common UI patterns, analyzed through the four-part microinteraction structure: Trigger, Rules, Feedback, and Loops & Modes. Each case study documents the interaction from first use through edge cases, providing a practical blueprint for implementation. ## Table of Contents 1. [Case Study 1: Form Submission](#case-study-1-form-submission) 2. [Case Study 2: Toggle / Switch](#case-study-2-toggle-switch) 3. [Case Study 3: Pull-to-Refresh](#case-study-3-pull-to-refresh) 4. [Case Study 4: Loading States](#case-study-4-loading-states) 5. [Case Study 5: Notifications (Toast / Snackbar)](#case-study-5-notifications-toast-snackbar) 6. [Cross-Cutting Patterns](#cross-cutting-patterns) --- ## Case Study 1: Form Submission A form submission microinteraction covers the moment from when the user taps "Submit" to when they receive confirmation of success or details of failure. It is one of the highest-stakes microinteractions because users have invested time and data. ### The Four Parts **Trigger:** - Manual trigger: "Submit" button (primary action, full-width or prominent) - Keyboard trigger: Enter key in last field (convention, not always expected) - System trigger: Auto-save draft after 30 seconds of inactivity (background) **Rules:** 1. On trigger, validate all required fields client-side before sending to server 2. If validation fails, prevent submission and highlight first invalid field 3. If validation passes, disable submit button and show loading state 4. Send data to server 5. On server success (200), show success feedback and redirect or reset form 6. On server error (4xx/5xx), show error message and preserve all input 7. On network timeout (>15 seconds), show retry option with preserved input **Feedback:** | State | Visual | Copy | Duration | |-------|--------|------|----------| | **Idle** | Blue "Submit" button, normal state | "Submit" or "Create Account" | Persistent | | **Validating** | Button briefly disabled | "Checking..." | 0-500ms | | **Validation error** | Red border on invalid fields, scroll to first error | "Please enter a valid email" inline | Until corrected | | **Submitting** | Button shows spinner, text changes | "Submitting..." | Server response time | | **Success** | Green checkmark replaces spinner | "Done! Redirecting..." | 1-2 seconds | | **Server error** | Red banner at top, button re-enabled | "Something went wrong. Please try again." | Until dismissed | | **Network error** | Yellow banner, retry button | "Connection lost. Your data is saved locally." | Until retry succeeds | **Loops & Modes:** - Auto-save loop: draft saved to local storage every 30 seconds (open loop) - Long loop: after 3+ submissions, hide optional tooltips and field hints - No modes (single-purpose interaction) ### Edge Cases | Edge Case | Handling | |-----------|---------| | User double-clicks submit | Disable button on first click; debounce server request | | User navigates away mid-submission | Show "Unsaved changes" dialog; save draft to local storage | | Session expires during submission | Queue submission; re-authenticate and retry | | Very long form (20+ fields) | Show progress indicator; validate sections independently | | Paste of formatted text | Strip formatting; accept plain text only | | Autofill conflict | Accept autofill values; re-validate on submit | ### Implementation Notes | Platform | Key Detail | |----------|-----------| | **Web** | Use `