Recipe
Form submit feedback
Disable + spinner on submit; toast success; modal for hard failures.
Parts
- Button / Action ButtonA semantic control for an action, with hierarchy expressed through its visual variant.
- Spinner / Activity IndicatorA compact motion indicator that something is busy—usually circular or system-native.
- Toast / SnackbarA brief, non-blocking status bar that appears after an action and dismisses itself.
- Modal DialogA centered window that blocks the page until the user responds.
Stack: React + Tailwind + shadcn/ui. Use React with Tailwind CSS and shadcn/ui patterns (Radix-based primitives, cn(), class-first styling).
Product task: Form submit feedback
Disable + spinner on submit; toast success; modal for hard failures.
Compose these UI patterns:
- Button / Action Button: A semantic control for an action, with hierarchy expressed through its visual variant.; use shadcn Button (variants)
- Spinner / Activity Indicator: A compact motion indicator that something is busy—usually circular or system-native.; use lucide Loader2 animate-spin / shadcn patterns
- Toast / Snackbar: A brief, non-blocking status bar that appears after an action and dismisses itself.; use sonner toast() / shadcn Toast
- Modal Dialog: A centered window that blocks the page until the user responds.; use shadcn Dialog / Radix Dialog
Brief:
Form submit feedback:
1. On submit: primary Button shows Spinner, becomes disabled; prevent double submit.
2. Success: non-blocking Toast ("Saved") that auto-dismisses; optional Undo only if safe.
3. Field validation errors: inline next to fields, not only a toast.
4. Hard / server failure that needs a decision: Modal with Retry / Cancel — not a toast with buttons.
5. Restore focus sensibly after success or dismiss.
Keep copy short and stack-idiomatic.
Implement as a minimal, coherent flow. Match existing project style.