Migrate from Radix Dialog
import * as Dialog from '@radix-ui/react-dialog';import { Dialog } from 'scrollsheet';import 'scrollsheet/styles.css';Start with the same JSX and review the behavior differences below. Dialog.Root, Trigger, Portal, Overlay, Content, Title,
Description, and Close all exist and render scrollsheet’s centered modal: a real
<dialog> in the top layer, zoom+fade on a spring, native focus containment. Sheet-only
consumers ship none of it; the adapter tree-shakes out unless imported.
If your CSS pipeline compiles custom properties away (postcss-css-variables and similar),
import from scrollsheet/auto instead and drop the stylesheet import.
What maps 1:1
Section titled “What maps 1:1”| radix | scrollsheet Dialog |
|---|---|
Root open / defaultOpen / onOpenChange / modal |
same props, same semantics |
Trigger, Close, Title, Description (asChild included) |
same |
Content className / ref / asChild |
same; your CSS owns the width |
[data-state="open"] / [data-state="closed"] keyframes |
stamped on Content’s element, existing animation CSS keeps matching |
Beyond radix, Root also takes scrollsheet’s own actionsRef, animationSpeed,
backdropDismissible, escapeDismissible, nonce, and onOpenChangeComplete (fires after an open or close
transition ends).
What changes
Section titled “What changes”| radix pattern | recipe |
|---|---|
onPointerDownOutside={(e) => e.preventDefault()} |
backdropDismissible={false} on Dialog.Root |
onInteractOutside |
same: backdropDismissible={false} |
onEscapeKeyDown={(e) => e.preventDefault()} |
escapeDismissible={false} on Dialog.Root |
onOpenAutoFocus / onCloseAutoFocus / onFocusOutside |
drop them; native showModal() owns focus, autofocus on a field overrides the initial target |
forceMount |
drop it; the open lifecycle owns mount timing |
Portal container={...} |
drop it; the <dialog> top layer replaces portaling |
Overlay with overlay CSS |
keep the element (it renders nothing); restyle the real backdrop via .scrollsheet-backdrop or --scrollsheet-backdrop |
Each unsupported prop warns once in development with a suggested replacement. Production builds omit the warning text.
Radix Content is unstyled; scrollsheet guards with --scrollsheet-center-max-inline
(default min(560px, 100%)). Your className’s width wins below the guard; raise the
variable for wider dialogs. On browsers without <dialog> support, the dialog
degrades to a centered static modal with the same width variables.
Going native
Section titled “Going native”Dialog.* wraps <Sheet.Root side="center">. Use Sheet.* directly for additional options,
including desktopSide to show a dialog on desktop and a bottom sheet on phones.