You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Base UI Dialog and Alert Dialog do not render Backdrop for nested dialogs by default (nested dialogs docs). This is intentional: child backdrops are skipped so parent dialogs can stay visible behind the top layer.
For many apps, this creates poor UX when dialogs are stacked (e.g. “Make offer” → “Add organization”):
Only the root dialog gets a real backdrop (bg-black/10)
Nested layers have no backdrop element, so the screen does not progressively darken
Workarounds require fragile CSS (:has() selectors, portal ::before pseudo-backdrops) or duplicating DialogContent outside the registry component
Base UI added an escape hatch in mui/base-ui#2037: forceRender on Backdrop, which renders nested backdrops even when nested === true.
The current shadcn Base UI Dialog registry item does not use this prop:
Stacked bg-black/10 overlays naturally produce progressive darkening. Pair with Base UI’s recommended parent-dim CSS using [data-nested-dialog-open] and var(--nested-dialogs) (documented in Base UI nested dialog examples).
Option B — Opt-in via DialogContent prop
For apps that prefer Base UI’s default (no nested backdrop), expose:
functionDialogContent({
overlayForceRender =true,// or false by default for backward compat
...
}: DialogPrimitive.Popup.Props&{showCloseButton?: booleanoverlayForceRender?: boolean}){return(<DialogPortal><DialogOverlayforceRender={overlayForceRender}/>
...
</DialogPortal>)}
DialogOverlay already spreads {...props}, so consumers can pass forceRender today — but DialogContent hardcodes <DialogOverlay /> without forwarding overlay props, so the prop never reaches Backdrop unless users recompose the portal manually.
Option C — Forward overlay props from DialogContent
Apps can wrap the registry component in a local module that re-exports everything except DialogOverlay / DialogContent, adding forceRender there — but this duplicates DialogContent markup and breaks on every shadcn add dialog --overwrite style update.
Affected component/components
Dialog
Additional Context
No response
Before submitting
I've made research efforts and searched the documentation
Feature description
Problem
Base UI Dialog and Alert Dialog do not render Backdrop for nested dialogs by default (nested dialogs docs). This is intentional: child backdrops are skipped so parent dialogs can stay visible behind the top layer.
For many apps, this creates poor UX when dialogs are stacked (e.g. “Make offer” → “Add organization”):
bg-black/10):has()selectors, portal::beforepseudo-backdrops) or duplicatingDialogContentoutside the registry componentBase UI added an escape hatch in mui/base-ui#2037:
forceRenderonBackdrop, which renders nested backdrops even whennested === true.The current shadcn Base UI Dialog registry item does not use this prop:
(
AlertDialogBackdrop is the same.)Proposed solution
Enable nested backdrops in the generated components. Options (in order of preference):
Option A — Default
forceRenderon Backdrop (simplest)Stacked
bg-black/10overlays naturally produce progressive darkening. Pair with Base UI’s recommended parent-dim CSS using[data-nested-dialog-open]andvar(--nested-dialogs)(documented in Base UI nested dialog examples).Option B — Opt-in via
DialogContentpropFor apps that prefer Base UI’s default (no nested backdrop), expose:
DialogOverlayalready spreads{...props}, so consumers can passforceRendertoday — butDialogContenthardcodes<DialogOverlay />without forwarding overlay props, so the prop never reaches Backdrop unless users recompose the portal manually.Option C — Forward overlay props from
DialogContentWhy shadcn should care
forceRender, the registry pushes users toward CSS hacks or forkingDialogContent@base-ui/react, with negligible bundle impact (+21B gzip per Base UI’s own measurement in [dialog][alert dialog] AddforceRenderprop toBackdroppart mui/base-ui#2037References
forceRenderprop to BackdropWorkaround today
Apps can wrap the registry component in a local module that re-exports everything except
DialogOverlay/DialogContent, addingforceRenderthere — but this duplicatesDialogContentmarkup and breaks on everyshadcn add dialog --overwritestyle update.Affected component/components
Dialog
Additional Context
No response
Before submitting