--- name: generic-react-ux-designer description: Professional UI/UX design expertise for React applications. Covers design thinking, user psychology (Hick's/Fitts's/Jakob's Law), visual hierarchy, interaction patterns, accessibility, performance-driven design, and design critique. Use when designing features, improving UX, solving user problems, or conducting design reviews. --- # React UX Designer Professional UX expertise for React/TypeScript applications. **Extends:** [Generic UX Designer](../generic-ux-designer/SKILL.md) - Read base skill for design thinking process, user psychology, heuristic evaluation, and research methods. ## React Interaction Patterns ### Micro-interactions with Framer Motion ```tsx // Checkbox animation // Button press feedback Click me // Toast notification ``` ### Loading States ```tsx // Skeleton (preferred over spinners)
// Progress indicator for long operations
``` ### Optimistic UI Pattern ```tsx const handleLike = async () => { // Update UI immediately setLiked(true); setCount((c) => c + 1); try { await api.like(id); } catch { // Rollback on error setLiked(false); setCount((c) => c - 1); toast.error("Failed to save"); } }; ``` ## React Accessibility Patterns ### Focus Management ```tsx // Modal focus trap function Modal({ isOpen, onClose, children }: ModalProps) { const modalRef = useRef(null); useEffect(() => { if (isOpen) { const firstFocusable = modalRef.current?.querySelector( "button, [href], input, select, textarea", ) as HTMLElement; firstFocusable?.focus(); } }, [isOpen]); // Trap focus within modal const handleKeyDown = (e: KeyboardEvent) => { if (e.key === "Tab") { const focusables = modalRef.current?.querySelectorAll( "button, [href], input, select, textarea", ); // Handle tab cycling... } if (e.key === "Escape") onClose(); }; return (
{children}
); } ``` ### Keyboard Navigation ```tsx // Custom keyboard shortcut useEffect(() => { const handleKeyDown = (e: KeyboardEvent) => { if ((e.metaKey || e.ctrlKey) && e.key === "k") { e.preventDefault(); openCommandPalette(); } }; window.addEventListener("keydown", handleKeyDown); return () => window.removeEventListener("keydown", handleKeyDown); }, []); // Arrow key navigation in list const handleKeyDown = (e: KeyboardEvent, index: number) => { switch (e.key) { case "ArrowDown": e.preventDefault(); focusItem(index + 1); break; case "ArrowUp": e.preventDefault(); focusItem(index - 1); break; } }; ``` ### Motion Accessibility ```tsx // Respect prefers-reduced-motion const prefersReducedMotion = window.matchMedia( "(prefers-reduced-motion: reduce)", ).matches; ; ``` ## Form UX Patterns ### React Hook Form Integration ```tsx function ContactForm() { const { register, handleSubmit, formState: { errors }, } = useForm(); return (
{errors.email && (

{errors.email.message}

)}
); } ``` ### Inline Validation ```tsx // Validate on blur, show on focus const [touched, setTouched] = useState(false); const [error, setError] = useState(""); { setTouched(true); setError(validate(value)); }} onFocus={() => setError("")} // Clear while editing className={touched && error ? "border-red-500" : ""} />; ``` ## Modal/Dialog Patterns ### Confirmation Dialog ```tsx function ConfirmDialog({ isOpen, onConfirm, onCancel, title, message }: Props) { return (

{title}

{message}

); } ``` ### Command Palette (⌘K Pattern) ```tsx function CommandPalette({ isOpen, onClose }: Props) { const [query, setQuery] = useState(""); const inputRef = useRef(null); useEffect(() => { if (isOpen) inputRef.current?.focus(); }, [isOpen]); const filtered = useMemo( () => commands.filter((c) => c.label.toLowerCase().includes(query.toLowerCase()), ), [query], ); return (
setQuery(e.target.value)} placeholder="Type a command..." aria-autocomplete="list" />
    {filtered.map((cmd) => (
  • {cmd.label}
  • ))}
); } ``` ## Empty & Error States ```tsx // Empty state with action function EmptyState({ title, description, action }: Props) { return (

{title}

{description}

); } // Error state with retry function ErrorState({ error, onRetry }: Props) { return (

Something went wrong

{error.message}

); } ``` ## React UX Checklist **Interaction Quality:** - [ ] Immediate feedback on user actions - [ ] Loading states for async operations - [ ] Optimistic updates where appropriate - [ ] Smooth animations (60fps) **Accessibility:** - [ ] Keyboard navigation complete - [ ] Focus management in modals - [ ] Motion respects prefers-reduced-motion - [ ] ARIA labels on interactive elements **Forms:** - [ ] Inline validation - [ ] Clear error messages - [ ] Smart defaults - [ ] Progress indication for multi-step ## See Also - [Generic UX Designer](../generic-ux-designer/SKILL.md) - Design thinking, psychology - [UX Principles](../_shared/UX_PRINCIPLES.md) - Research methods, heuristics - [Design Patterns](../_shared/DESIGN_PATTERNS.md) - Visual patterns