# Overlay Best Practices Use `@langgenius/dify-ui/*` primitives for overlays in new and modified web code. Do not import raw Base UI overlays or legacy web overlays from `@/app/components/base/modal`, `@/app/components/base/dialog`, or `@/app/components/base/drawer`. ## Primitive choice - Use `@langgenius/dify-ui/dialog` for modal surfaces that need focus management, scroll locking, escape handling, and outside-press dismissal. - Use `@langgenius/dify-ui/alert-dialog` only for destructive or must-confirm decisions. - Use `@langgenius/dify-ui/drawer` for side panels, setup panels, and nested editor panels that must behave like a drawer. Do not add separate web drawer wrappers. - Use `@langgenius/dify-ui/popover` or the web `Infotip` wrapper for explanatory content, long help text, rich layout, or interactive content. - Use `@langgenius/dify-ui/tooltip` only for short, non-interactive labels where the trigger already has its own accessible name. ## Preferences - Prefer the most specific semantic primitive over styling a generic `Dialog`. - Prefer controlled `open` / `onOpenChange` when business state, analytics, or cleanup must react to open state changes. - Prefer the primitive-owned portal or content component. Do not create manual portals around overlay primitives. - Prefer native button trigger semantics. When passing a Base UI trigger `render` prop, render a real `