# Forms and Modal Patterns ## Contents - [FocusModal vs Drawer](#focusmodal-vs-drawer) - [Edit Button Patterns](#edit-button-patterns) - [Simple Edit Button (top right corner)](#simple-edit-button-top-right-corner) - [Dropdown Menu with Actions](#dropdown-menu-with-actions) - [Select Component for Small Datasets](#select-component-for-small-datasets) - [FocusModal Example](#focusmodal-example) - [Drawer Example](#drawer-example) - [Form with Validation and Loading States](#form-with-validation-and-loading-states) - [Key Form Patterns](#key-form-patterns) ## FocusModal vs Drawer **FocusModal** - Use for creating new entities: - Full-screen modal - More space for complex forms - Better for multi-step flows **Drawer** - Use for editing existing entities: - Side panel that slides in from right - Quick edits without losing context - Better for single-field updates **Rule of thumb:** FocusModal for creating, Drawer for editing. ## Edit Button Patterns Data displayed in a container should not be editable directly. Instead, use an "Edit" button. This can be: ### Simple Edit Button (top right corner) ```tsx import { Button } from "@medusajs/ui" import { PencilSquare } from "@medusajs/icons"