Skip to content
RefineUI

Dialog

Modal dialog window overlay for critical tasks.

Overview

Machine-readable contract from Component Spec.

component: dialogexport: Dialogversion: 1recipe: dialogtokens.visual: dialogattributes: data-refineui=dialog

Anatomy

Partdata-refineui
rootdialog
scrimpresentation
panelpanel
headerheader
titletitle
descriptiondescription
bodycontent
closeclose

Variants

AxisValues
sizesm, lg

States

ScopeCategoryValues
componentpseudofocus-visible
componentcomponentdata-state: open, closed
componentenvironmentforced-colors, dir, prefers-contrast
dialogcomponentdata-state: open, closed

Accessibility

SlotElementRoleRequired attributesLabeling
dialogdivdialogaria-modal: required=true, type: boolean; aria-labelledby: required=true, type: stringlabelledBy: title; describedBy: optional

Keyboard

KeyActionNative
Escapeclose

Focus

SectionPropertyValue
visualrequiredtrue
visualselector:focus-visible
behaviortraptrue
behaviorinitialfirst-focusable
behaviorreturntrigger

Layout

PropertyValue
directionlogical
rtltrue

Variant

Select a recipe variant — preview and Recipe → Tokens update together.

Recipe → Tokens

Slot bindings for variant="default" — declared in dialog.recipe.ts.

SlotVariantPropertyTraceSemanticLight → foundationDark → foundationRecipe class
panelbackgrounddialog.panel.backgroundbackgroundPrimaryneutralWhiteneutral900bg-refineui-alias-background-primary
titleforegrounddialog.title.foregroundforegroundPrimaryprimaryBlackneutralWhitetext-refineui-alias-foreground-primary
descriptionforegrounddialog.description.foregroundforegroundSecondaryneutral600neutral350text-refineui-alias-foreground-secondary

Component token trace

All paths in token-trace-v2.json prefixed with dialog.

TraceSemanticLight foundationDark foundationLightDark
dialog.content.backgroundbackgroundPrimaryneutralWhiteneutral900#FFFFFF#1A1A1A
dialog.description.foregroundforegroundSecondaryneutral600neutral350#6C6C6C#D8D8D8
dialog.header.foregroundforegroundPrimaryprimaryBlackneutralWhite#212121#FFFFFF
dialog.overlaysurfaceOverlay
dialog.panel.backgroundbackgroundPrimaryneutralWhiteneutral900#FFFFFF#1A1A1A
dialog.panel.descriptionforegroundSecondaryneutral600neutral350#6C6C6C#D8D8D8
dialog.panel.titleforegroundPrimaryprimaryBlackneutralWhite#212121#FFFFFF
dialog.title.foregroundforegroundPrimaryprimaryBlackneutralWhite#212121#FFFFFF
npm install @refineui/react @refineui/tokens
import {
Dialog,
DialogTrigger,
DialogContent,
DialogHeader,
DialogTitle,
DialogDescription,
DialogClose,
Button,
} from "@refineui/react";
<Dialog>
<DialogTrigger asChild>
<Button>Open Dialog</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Confirm Action</DialogTitle>
<DialogDescription>
Are you sure you want to continue?
</DialogDescription>
</DialogHeader>
<DialogClose asChild>
<Button>Cancel</Button>
</DialogClose>
</DialogContent>
</Dialog>
<Dialog size="sm" open={isOpen} onOpenChange={setIsOpen}>
<DialogContent scrollable={false}>
{/* Content with custom scroll handling */}
</DialogContent>
</Dialog>

Contract source: packages/react/spec/components/dialog.json — rendered by SpecRenderer above.