Radix UIKeyframes
Dialog
The stop-ship case. If exit works here, it works on every Radix primitive that routes through Presence.
Every value the manifest allows on this host, single presets and the pairs that compose. The first is what this component ships with. Both stages are the same component, so anything that changes between them is the attribute.
withoutno attribute
with easefuldata-motion="scale-fade"
host writes
data-state="open" | "closed"
easeful matches
[data-motion~="scale-fade"][data-state="closed"]
what runs
animation: motion-exit 150ms
you write
<Dialog.Content data-motion="scale-fade" />
Where the attribute goes
The parts this demo composes, and the value each one carries. Everything inside an animated part is that part's content, so the tree stops there.
Dialog.RootDialog.TriggerDialog.PortalDialog.Overlaydata-motion="fade"Dialog.Contentdata-motion="scale-fade"
Source
"use client"
import { Dialog } from "radix-ui"
import type { DemoProps } from "@/components/demos/props"
export function RadixDialog({ motion }: DemoProps) {
return (
<Dialog.Root>
<Dialog.Trigger className="btn">Open dialog</Dialog.Trigger>
<Dialog.Portal>
<Dialog.Overlay className="scrim" data-motion={motion && "fade"} />
<Dialog.Content className="modal" data-motion={motion}>
<Dialog.Title className="panel__title">Publish this release</Dialog.Title>
<Dialog.Description className="panel__body">
Closing is the half worth watching. Presence holds the node until the exit keyframe
finishes, then unmounts it.
</Dialog.Description>
<div className="modal__actions">
<Dialog.Close className="btn btn--primary">Publish</Dialog.Close>
<Dialog.Close className="btn">Cancel</Dialog.Close>
</div>
</Dialog.Content>
</Dialog.Portal>
</Dialog.Root>
)
}motion prop is the only difference between them.