Components · Overlays
Dialog
A centered overlay on a scrim for a decision or a few fields people must finish before they continue, with a wide size for a large form filled in one pass.
import { Dialog } from "@botiverse/raft-ui";A dialog is a centered overlay on a scrim for something people must finish before they continue: a decision, or a small task of a few fields, such as creating a channel. It has a title, a body and at most two buttons. Its wide size holds a large form filled in one pass. A confirmation is a Dialog too, at size="sm", whether the action can be undone or not; AlertDialog is only for the few confirmations a product lists (Choosing a component, 2026-11-03).
When to use
Which overlay fits which job is in Choosing a component.
Anatomy
Dialog: the root. Owns the open state. Required.DialogTrigger: the button that opens it.DialogContent: the centered surface, portaled, with the scrim (DialogOverlay) behind it. Required. On a desktop and a tablet,placement="top"puts its top edge near the top of the window instead of the middle (At the top).DialogHeader: the title row, with an optionalDialogCloseat its end. The × is pulled out so its icon box, not the button, ends on the dialog's margin (--surface-inset: 20px, 16px with a mouse) (Alignment).DialogTitle: the title. Required.DialogDescription: a helper sentence under the title or in the body, inforeground-muted, only for a consequence (consequence), who sees it or whom it affects (audience), or how to recover (recovery). It takes only aHelperText, made withhelperText(content, { why, about }), and renders itswhyandaboutasdata-whyanddata-about(Writing › Helper text).DialogBody: the content, in the base ink (foreground). Numbered steps ("Step 1 of 2: name the computer") are body text here, not a description. It scrolls when the dialog reaches the window height, natively, or under raft-ui's scrollbar withunstable_scrollArea(Scrolling in a ScrollArea).DialogFooter: the buttons in one row at the end, with a note or aTextLinkat its start. It stacks them only when they don't fit on one line (The footer).DialogFooterNote(@botiverse/raft-ui/wip): one short line at the start of the footer that says what the commit button will do, in muted footnote text. It takes aHelperText, asDialogDescriptiondoes ("You'll be billed $8 for each new member",consequence). Only in asize="lg"orsize="wide"dialog. An empty note draws nothing.DialogClose: closes the dialog. Without children it is the × icon button; withrenderit turns a Cancel button into a close button.DialogNav: the section list of a wide dialog.DialogSurface: the dialog's frame without Base UI behind it, for a centered modal whose app owns the backdrop, Esc and focus, such as a step of the server setup. PreferDialogContent: search moved offDialogSurfaceonto it (slock #14142).DialogPortalandDialogOverlay: lower-level parts.DialogSheetContent:DialogContentfor a dialog that becomes a sheet on a phone (On a phone). On a desktop and a tablet it isDialogContent, the same markup.DialogCommit: the dialog's one commit button, aButtonwritten at the end ofDialogFooter. In a sheet on a phone it is drawn at the end of the head instead.DialogSheetBack: Back at the start of a sheet's head, in a later step of a flow. It draws nothing outside a sheet. On a touch screen it goes back when the finger lifts (Switching on finger lift).
Variants
Pick the size by what the dialog holds, not by what looks right. The four sizes are far enough apart that each holds one kind of content (cindyz, 2026-10-21):
- Every confirmation is one width, 400px, whether it is built on Dialog or AlertDialog. A confirmation whose content no longer fits 400px isn't a confirmation any more: it is a small task, at
md. sm,mdandlgare the small dialog: its height follows its content, up to the window less 32px, and a click on the scrim closes it.wideis the large form dialog.- Set the width with
sizeonly. Product code never passes its ownmax-w-*toDialogContent. Content that fits none of the four sizes isn't a dialog: make it a page or a Drawer. - Only these overlays have a width outside the four sizes, each set by its own rule. Nothing else may add one:
- Task details and Send prompt, 960px wide (or the window less 32px) and at most 900px or 86% of the window high, whichever is smaller, full screen on a phone: workspace overlays. Task details is in Tasks. Send prompt hands a prompt to one agent, drawn as the DM with it: the agent in the head with a switch to pick another, the last 5 messages of the DM, read only, and the real composer with the prompt filled in (cindyz, 2026-11-23, #proj-raft-ui:#297; slock #16396).
- Search, 720px, a
DialogContentwithplacement="top", its top edge over the top bar's field through--dialog-top(At the top, Search). - The showcase frame, 720px wide and about 520px high, shared by steps 3 to 5 of onboarding, the Upgrade to Pro dialog and Pro's Add seats dialog (cindyz, 2026-10-26: adding seats is a paywall, like upgrading), and used by nothing else (Onboarding).
- AnnouncementDialog, 576px: its picture and one-paragraph text read best there; at 640px the text runs past 80 characters a line.
- An attachment preview, as wide as the file needs, up to 768px.
- On a narrow screen every size is as wide as itself or the window less 32px, whichever is smaller, so at 390px each one is 358px wide. Its height and the wide dialog's sections are in Behavior.
Deleting something large, such as an agent or a server, also asks for its name to be typed (Forms). It is still a confirmation, at sm, with the confirm button red (AlertDialog):
The large form dialog uses bar on DialogHeader, DialogBody and DialogFooter: the header and footer stay in place and the body scrolls between them. The body holds DialogNav on the left, a line-seam after it, and one FormSection per section on the right, in a pane that scrolls and pads its content by --surface-inset on every side, the top included: a section starts flush, so the pane keeps the first one clear of the header. Its structure and rules are in Forms.
A chooser
A chooser is a small dialog whose only content is a short list of ways to do one thing, such as Add members › Add agent, with Create agent and Connect an external agent (Kirby, 2026-11-24, #triage:#619, asked for by cindyz).
- Make each way a ListRow in an inset
ListRowGroup:variant="plain", a small icon, the way's name, aListRowSubtitlethat says what it is, andListRowChevron. - Clicking a row closes the chooser and opens that way's own dialog: one dialog after another, never one stacked on the chooser.
- Give it no footer: ×, Esc and a click on the scrim close it.
- Title it with the label of the control that opened it (Writing).
- Use it instead of a DropdownMenu when each way needs a line of explanation to choose between them. When the names alone are enough, a menu stays the choice.
- When the follow-up dialog closes, focus returns to the control that opened the chooser.
- On a phone it stays a centered dialog, as a few fixed choices with no typing do (On a phone). A follow-up dialog that is a sheet on a phone opens with ×, not Back: the chooser is closed, so it isn't an earlier step of the same flow.
The footer
Cancel comes first and the commit button last, both at the end of the footer, so the commit button is where the eye ends: bottom right. The start of the footer holds at most one quiet item, never both: a muted TextLink that leads elsewhere, or a DialogFooterNote that says what the commit will do. Either one is safe to miss, because people don't look there first.
A dialog that is only read has one button, which closes it. It is still pink, so the dialog keeps one obvious way forward.
The footer stays one row on a phone, the same as on a desktop (stdrc, 2026-10-22). One layout everywhere means Cancel and the commit button are in the same place on every screen; stacking is only a fallback for a label too long for the row. So the footer stacks when its buttons don't fit on one line, at any width, and never because the window is narrow:
- The buttons stack full width, the commit button on top and Cancel under it. Cancel takes the ink border of
defaultthere, with its hover and press: a frameless button stretched to the full width reads as a line of text, not a button, so once buttons stack each needs its own box (stdrc, 2026-10-22). Keep writing Cancel asghost; the stack gives it the frame, and it goes back to frameless when the row fits again. - A note or a link stays first, left-aligned above the buttons.
- Write the parts in the order of the row: the note or the link first, then Cancel, then the commit button. The footer turns the stack around on screen only: Tab still goes Cancel then commit, so in the stack focus moves up from Cancel to the commit button (Accessibility).
Use a note only in a size="lg" or size="wide" dialog, and keep it to 40 characters. Put DialogFooterNote directly in DialogFooter, before the buttons: the footer then holds the buttons as one group. On a desktop the note is one line and never wraps, and it is never cut. It sits beside the buttons when both fit on the line; when they don't, it goes above them and the buttons stay one row at the end, so they never leave the footer's padding. A link at the start does the same. A smaller dialog has no room for a note beside its buttons: a development build warns when a note is in a sm or md dialog, the default included, unless a className sets the dialog's width instead (one of the exceptions in Variants). On a phone, above the buttons, the note has the footer's full width and may wrap to 2 lines. Anything longer belongs in the body.
When the dialog is a sheet on a phone (On a phone), it has no footer, so the note, or a link written first, moves to the end of the body. The note keeps the same muted footnote text, left-aligned, at most 2 lines; the sheet's commit button in its head does what the note describes. The link becomes a full-width outline button there (The sheet).
Behavior
- A centered dialog appears and disappears without animation, always over the scrim (Motion). On a phone a dialog with fields is a sheet that slides up instead (On a phone).
- It opens the same however it was mounted: opened after it mounted, or mounted already open (
openordefaultOpen, a lazy or conditional mount, a freshkey), so a phone sheet mounted open slides up too. Base UI plays the enter only whenopenturns true after the root mounted, soDialogmounts closed and opens one commit later, before the first paint, as Drawer, AlertDialog and Lightbox do. They all wait the same commit, so surfaces mounted open together still stack in their order (#proj-frontend:#121). - Esc, × and Cancel close a dialog. A click on the scrim closes a small dialog, except one drawn as a sheet on a phone (On a phone).
- Esc closes only the topmost thing that is open. A Menu or a Select opened from the dialog closes on Esc and the dialog stays open; the next Esc closes the dialog. In a widget of your own that closes on Esc, such as a suggestion list in a text box, call
event.stopPropagation()in itsonKeyDown, not onlypreventDefault(): Base UI closes the dialog on every Esc that reaches it, prevented or not. When you can't change the widget, cancel the close inonOpenChangeonDialogwhendetails.reasonis"escape-key"anddetails.event.defaultPreventedis true. - Don't close a large form dialog on a click outside it: pass
disablePointerDismissalonDialog, so a half-filled form isn't lost to a stray click. - A centered dialog on a narrow screen keeps a 16px margin on each side and never grows taller than the window less 32px.
- On a desktop and a tablet, a dialog with
placement="top"sits near the top of the window instead of the middle (At the top). - On a phone a centered dialog moves up while the on-screen keyboard is open, and goes back to the middle when it closes (On a phone).
- Below 768px the wide dialog hides
DialogNavand the sections follow one another. DialogFooterkeeps its buttons in one row at every width. It measures the row laid out as a row, and only when its children run past the footer does it setdata-stackedand stack them full width, the commit button on top (The footer). Content that may shrink, such as a label that truncates or wraps, shrinks first, so only what can't, the buttons, makes the footer stack. It measures again when the dialog resizes, a label changes or a font loads, and not at all while the footer is hidden in a sheet. A button wrapped in another element, such as a tooltip's trigger, fills the width too.AlertDialogFooterdoes the same.- A footer that sets its own layout with
className, such as a checkbox beside the button or a pair of links, is measured the same way and needs nothing more: it keeps that layout while its content fits on one line, and stacks only when it doesn't. Give text that may give waymin-w-0(andtruncateto cut it), so it shrinks before the footer stacks. - A dialog opened from a dialog or a sheet draws its own, lighter scrim over the one below (Stacked overlays). Render it inside the first one and this happens by itself.
layer={1}is only for a dialog rendered outside the first one's tree: it lifts the dialog and its scrim above the first. What is lifted is the dialog's portal, toz-dialog-layeras a stacking context of its own, so a Select list or a menu opened from the card, which Base UI portals into the same element, is drawn over the card; the scrim follows the card, so alayerinoverlayis ignored there. Before, the card and the scrim were lifted and the list stayed atz-popup, under both, and an app had to portal each list into the dialog's body. - A Select list, a menu or a popover opened from a dialog is portaled beside its card, inside the dialog, so it is drawn over the card and its head, and focus and a press on it stay inside the dialog. Don't pass it a
containerinside the dialog's scrolling body to get that: a ScrollArea is a stacking context of its own, so a list portaled into one is drawn under the head whenever it reaches it (ScrollArea). In a phone sheet the list also stays under the head (Popups in a sheet). - An app's own modal (its own backdrop, Esc and focus, on
DialogSurface) joins the same stack withOverlayLayerProvideranduseParentOverlayKindfrom@botiverse/raft-ui/wip(Stacked overlays).
At the top
On a desktop and a tablet, a dialog that grows out of something near the top of the window takes placement="top", so it opens where people were looking. Search is the case today: the panel's top edge covers the top bar's field, so the field seems to grow into it (Search). Centered, it would open somewhere else, and on a tall window far from the field.
- The dialog stays centered across. Its top edge sits at
--dialog-top, 8% of the window's height down when nothing sets it. - It never grows past the window's bottom less 16px, so it ends on screen however low its top is; its body scrolls instead. Its width still comes from
size. - To put the top edge on something, the app measures that thing as the dialog opens and sets
--dialog-topin thestyleofDialogContent. raft-ui measures nothing and knows nothing of what the dialog is anchored to. - Below 768px it does nothing: the dialog sits in the middle like every other, and
--dialog-topis ignored. Like every centered dialog there, it moves up only while the on-screen keyboard is open (On a phone). DialogSheetContenttakes it too, on a desktop and a tablet. On a phone a sheet is docked to the bottom and ignores it.
Scrolling in a ScrollArea
DialogBody scrolls natively, so on Windows, and on a Mac set to always show scrollbars, a long body draws the platform's scrollbar, which takes room from the body's width when it appears. With unstable_scrollArea the body is a ScrollArea instead: it scrolls the same way and draws raft-ui's scrollbar, which takes no room and looks the same on every platform and in both themes.
- It is opt-in for now and becomes the default in a later minor release. Nothing else about the body changes, so when it is the default, delete the prop.
- Use it for a body that can grow past the window: a form of many fields, a long list, a long text. A body that never scrolls draws no scrollbar either way.
- The body scrolls sideways too when something in it is wider than it (a wide table, a line that doesn't wrap, a
<pre>, an image), as the native body does: the dialog keeps its width, and a horizontal scrollbar shows along the body's bottom edge, over the footer. A body with nothing wider than itself scrolls down only and draws no horizontal scrollbar. Sideways, the whole body moves, its fields with the wide part, so for a wide table preferTableScroll(Table) around it: then only the table scrolls. In a body laid out as a grid (className="grid gap-4") one wide child also makes every row as wide as itself, with or without the prop, since the grid's one column takes the width of its widest item; aTableScrollaround the wide child, orgrid-cols-[minmax(0,1fr)]on the body, keeps the rows the body's width. - The body is still the element with
data-slot="dialog-body". It takesclassName,ref, the native props and the children as before, so a layout written on it (className="grid gap-4") is unchanged, and nothing is put inside it beside its children. It uses ScrollArea's absolute gutters: a frame,data-slot="dialog-body-frame", is rendered around the body and holds the scrollbar. - The frame, not the body, is the child of
DialogContent. A class that sizes the body in the dialog (max-h-*,h-*,flex-*) goes inwrapperClassName, which is the frame's; padding and layout stay inclassName. A selector of your own that reaches the body as a child of the content ([data-slot=dialog-content] > [data-slot=dialog-body]) no longer matches: select the frame, or the body as a descendant. - The body is a Tab stop only while it overflows and holds nothing that takes focus, as a native scroller is. A form adds no stop: Tab goes from the head to the first field, and the keyboard scrolls the body from whatever inside it has focus. A long text that is only read can be reached with Tab and scrolled with the arrow keys. A
tabIndexof your own wins. - A scroll that reaches the body's end stops there, and a Mac trackpad or iOS still bounces the body (
overscroll="contain", as in a Panel). - For a header or a footer stuck inside the body (
position: sticky), keep the scrollbar clear of it from the frame:wrapperClassName="[--r-scroll-area-rail-inset-bottom:56px]"(Edge state). - The frame is a stacking context of its own, as every ScrollArea is: a popup given a
containerinside the body is drawn under the dialog's head. Leave popups where raft-ui portals them, beside the card. - In a phone sheet (On a phone) it is the same body: it scrolls under the head on the 16px margin, keeps the home indicator's inset, and holds the footer's note or link at its end.
- A
barbody ignores it. On a desktop abarbody doesn't scroll: the sections inside it do, and itsDialogNavis a ScrollArea already. In a phone sheet abarbody still scrolls natively.
On a phone
Below 768px a dialog stays centered unless it has several fields, a long list or steps, in which case it becomes a sheet (stdrc and Artea, 2026-10-21). On a desktop and a tablet every dialog stays centered.
A dialog that stays centered keeps its footer in one row, as on a desktop. It stacks only when the buttons don't fit, the commit button on top (The footer).
The sheet
- Rises from the bottom over the scrim, with
radius-dialogon its top corners. The strip of page left above it shows that it is a layer over the page, not a new page. - Is as tall as its content, and at most 90% of the screen; a longer body scrolls inside it (artin, 2026-11-27, #proj-mobile:c2a6f94a). A sheet that was always 90% tall left the lower half of the screen empty under a step with one field. Neither platform opens every sheet at full height: Apple's guidelines say "In an iPhone app, consider supporting the medium detent to allow progressive disclosure" (Sheets), and Material's say a bottom sheet's first height "is capped at 50% of the screen height" (Bottom sheets). 90% stays the cap, so the strip of page above the tallest sheet is always there.
- When its content changes height, such as the next step of a flow or a text box that grows as people type, the sheet moves to the new height over 200ms with
ease-slide, growing or shrinking from its top edge, so a new step doesn't jump (Motion). With reduced motion it changes at once. A change of the window or the keyboard isn't animated: only the content's. - Its head is a pushed page's head (Navigation): × at the start, the title, and the dialog's one commit button at the end, at size
mdwith the same color and words as on a desktop. It has no footer: × is Cancel. In a flow of steps the button at the end is the step's (Next, then the last step's action). - From the second step of a flow on, Back takes the place of × at the start of the head, with no × beside it (stdrc, 2026-10-22): the sheet is a stack of steps, and Back undoes one, as on a pushed page. Esc still closes the sheet from any step; on a touch screen, people go Back to the first step and close it with ×.
- A footer note moves to the end of the body, in muted footnote text, left-aligned (The footer).
- A link written first in the footer moves to the end of the body as a full-width outline button (
Button,variant="default"), 32px tall with a 44px hit area, as the commit button in the head (artin, 2026-11-27, #proj-mobile:c2a6f94a). There it is the only thing a finger must hit, which a TextLink can't be (TextLink): it has no box, and on a touch screen no hover underline, so it read as plain text. It keeps its words and what it does, a real link included. - The body scrolls under the head and keeps the phone's 16px margin and the home indicator's inset at the bottom.
- × and Esc close it. A tap on the scrim doesn't, so a half-filled form isn't lost to a stray tap, as with a large form dialog on a desktop. When something has been typed, ask before closing (Asking before closing).
- Dragging the sheet down to close it is planned, for when the sheet moves onto Drawer's drag.
- It slides up as it opens, like every bottom sheet, and its scrim fades in with it (Motion). With reduced motion it is simply there.
- With the on-screen keyboard up, the sheet sits on the keyboard and is at most the space above it, so the head and its commit button stay in view. A sheet shorter than that keeps its height.
- An alert or a warning or destructive Banner that appears in the body after it opens, such as the error a failed commit adds, is scrolled into view: the button that caused it is at the top.
The keyboard
Every centered dialog on a phone moves up while the on-screen keyboard is open, whatever its placement, and no app opts in. A centered dialog covered by the keyboard is always wrong: the field people are typing in, or the buttons under it, are out of sight. So this is the platform's behavior, not a choice per dialog (stdrc, 2026-10-21: centered unless the keyboard is open).
- Its top edge goes where the phone's top bar ends:
--header-heightbelow the top of what is visible, under the status bar. - It ends at least 16px above the keyboard. When it is taller than that, its body scrolls.
- When the keyboard closes, it goes back to the middle.
- The keyboard counts as open only while a text field has focus and the visible area is more than 100px shorter than the window, so a short window with nothing to type in doesn't move it.
- A sheet doesn't move: it shrinks to the space above the keyboard instead.
Popups in a sheet
A Select or Combobox list, a menu or a popover opened from a field in a sheet stays in the sheet, under its head: it flips to the other side of its field and shrinks to the room between the head and the bottom of what is visible of the sheet, and its rows scroll. Nothing is passed for this: every raft-ui popup with no collisionBoundary of its own takes the sheet's, decided for that popup each time it is placed.
- Why: a popup otherwise keeps to the window. With the keyboard up the sheet is all that is left of the screen, and a list that flipped upward covered the head, the title and the commit button with it, and ran past the sheet's top edge.
- The room ends at the sheet's bottom edge, or at the top of the on-screen keyboard when that is higher (the visual viewport's bottom): what counts is what can be seen.
- A popup anchored in the head is left alone: a tooltip, a menu or a popover on a head button opens where it asks to, a tooltip above the button and over the scrim, as outside a sheet. Held under the head it would be pushed down over the sheet's content.
- A popup anchored in the sheet's body is always bounded, however little room its field has: the list takes the larger side, above or below the field, is as tall as that side less 12px (4px from the field, 8px from the edge of the area), and its rows scroll. Why: on a small phone with the keyboard up, a field in the middle of a sheet has about 130px on each side, and that is the commonest case, not a rare one. A list let over the head there covers the title and the commit button, or, portaled into the sheet's scrolling body, is drawn under the head, where its first rows can be neither seen nor pressed. A short list that scrolls can be used; one hidden under the head can't. No popup sets a least height, so with 60px on the larger side a list is 48px tall, about one row.
- It is drawn over the sheet's content, as from any dialog (Behavior).
- A dialog, an alert dialog, a drawer or a lightbox opened from the sheet starts again: its popups keep to the window, or to its own sheet. So does an app's own surface inside
OverlayLayerProvider. - A centered dialog bounds nothing: a list opened from a small card may run past the card's edge, over the scrim, as it always has.
- To opt one popup out, pass it
collisionBoundary="clipping-ancestors", Base UI's default, and it keeps to the window. AnycollisionBoundaryyou pass wins; leaving it out, or passingundefined, takes the sheet's. - A sheet you draw yourself, with its own surface, a head that stays put and a body that scrolls, gets the same from
SheetPopupBoundary(@botiverse/raft-ui/wip): wrap the body in it, or the head and the body, and give it the head's ref ashead. The sheet's bottom edge is the head's parent's, orsurface's when the head is nested deeper. It renders no element. When the sheet is also anOverlayLayerProvider, putSheetPopupBoundaryinside it. - Which element a popup is anchored to is read from the page: the open trigger whose
aria-controlsnames the popup's list or panel, and for a tooltip or a preview card, which nothing names, the one open trigger of its kind. A popup whose anchor can't be told, such as a context menu at the pointer, stays bounded. - Two tooltips open at once, or two preview cards, can't be told apart in a sheet you draw yourself, where a head button's tooltip is under
SheetPopupBoundarywhen it wraps the head: nothing names either, so both stay bounded, and one anchored in the head can flip downward, over the sheet's content. InDialogSheetContentandDrawerthe head starts outside the sheet, so its tooltips are never bounded. Wrap only the body, or pass the tooltip itsanchor. - A popup given an
anchoris decided by it, and nothing is looked up in the page: an element, a ref, or a function that returns one is in the head or isn't, like a trigger. A virtual element (an object withgetBoundingClientRect, such as a text selection) has no element to find in the head, so it is in the head when the middle of its rect is. Ananchorthat is empty when the popup is placed, a ref not yet set, falls back to the trigger. - In Safari on iOS the page pans under the keyboard, and the boundary is moved by the visual viewport's offset so it stays on the head: twice for a popup fixed to the window, once for one with
positionMethod="absolute"or portaled into a transformed element such as a drawer (@floating-ui/dom1.8 takes that offset from a boundary rect, and adds it to the field only for a popup fixed to the window). A rect you pass ascollisionBoundaryyourself is not corrected.
Making a dialog a sheet
Write the dialog as it is on a desktop and swap DialogContent for DialogSheetContent, and the commit Button for DialogCommit. Nothing else changes, and on a desktop nothing changes at all. Below 768px:
DialogHeaderbecomes the pushed page's head: itsDialogClosegoes first, as the head's ×, and itsDialogTitlefollows. Give the header aDialogCloseas a direct child: it is the only way out of the sheet. One wrapped in a Tooltip, a Fragment or a component of your own isn't found and stays after the title; in development the head warns about it in the console.- The head has room for one line, the title. A
DialogDescriptiongoes at the top ofDialogBodyin a sheet dialog, not inDialogHeader. DialogCommitmoves to the end of the head atsize="md", with the same variant, words, disabled and loading state. Atype="submit"button stays its form's default button: it is tied to the form it was written in by the form'sid, so a click and Enter in a field still submit, and neither does while it is disabled. Give thatformanid(or passformtoDialogCommit); without one a click still submits but Enter in a field doesn't, and only on a phone, so in developmentDialogCommitwarns about it in the console, as it does when a submitDialogCommithas no form to submit.DialogFooteris hidden, and with it Cancel and any other button in it, such as a step's Back. ADialogFooterNotemoves to the end ofDialogBodyinstead, left-aligned in muted footnote text; keep the note to 40 characters, so it is at most 2 lines there. ATextLinkwritten first in the footer, as its direct child and not inside a Fragment, moves there as a full-widthButtonwithvariant="default"andsize="md". It keeps the link's children,render(such as<a href>) and handlers, and drops itsvariantandclassName, which were for text. Nothing is passed for this.DialogBodyscrolls under the head on the phone's 16px margin, with the home indicator's inset at the bottom. A wide dialog'sbarbody does the same: itsDialogNavis hidden and its sections follow one another.- The sheet takes its height from the content, so nothing in the body needs a height for the sheet. A part that fills what it is given, such as a
ChoiceListwithfillin a body laid out as a flex column, is as tall as its rows, and scrolls inside the sheet once the sheet reaches 90%. Don't give the body or a child a height invhordvhto fill the sheet: it would make every sheet that tall again.
In a flow of steps, write each step's button as a DialogCommit: Next, then the last step's action. From the second step on, put a DialogSheetBack in DialogHeader: on a phone the head shows it at its start and leaves out the DialogClose, so a later step has Back and no ×; on a desktop it draws nothing and Back stays in the footer.
In the example below, the first step has one field, so on a phone the sheet is short, and Next grows it to the second step's content. The first step's footer starts with a link, which on a phone ends the body as a full-width outline button.
A dialog or an alert dialog opened from the sheet is centered over it, on its own lighter scrim (Stacked overlays). It keeps its own head, footer and commit button: only the sheet's own parts change.
Asking before closing
When something has been typed, × and Esc ask first. Cancel the close in onOpenChange on Dialog and open the confirm from inside the sheet:
<Dialog
open={open}
onOpenChange={(next, details) => {
if (!next && dirty) {
details.cancel();
setConfirmOpen(true);
return;
}
setOpen(next);
}}
>The example below is wired that way; its canvas shows the confirm after × with edits.
A dialog that stays centered on a phone keeps DialogContent and Button.
Content
- Title the dialog with the words of the button that opened it, or Edit and the item's name. A confirmation that only asks whether to go on, with nothing to fill in or choose, adds a question mark (Delete box?); a dialog with something to fill in or choose doesn't (Delete server) (Writing). Label its main button with the action it performs, without the object: usually the title's verb (Create channel → Create); an Edit title's button is Save, and the other one Cancel (Writing).
- Set body text in
foreground, as the title is; only aHelperTextinDialogDescriptionorDialogFooterNoteisforeground-muted. Their type styles are in Typography.
Accessibility
- Dialog wraps the Base UI Dialog. It provides the
dialogrole, the focus trap, Esc and focus return to the trigger. - Give every dialog a
DialogTitle. It becomes the dialog's accessible name, and it is what a screen reader announces on open. DialogDescriptionbecomes the dialog's description.- The focus order and the reading order are the markup's: the note or the link, Cancel, then the commit button. In the row that is the order seen. When the buttons stack, the commit button is drawn on top but stays after Cancel in the markup, so focus goes up from Cancel to it, as it would in any browser. The footer doesn't use
reading-flowto follow the stack: the dialog's focus trap wraps in markup order, and a visual order fights it, trapping Tab on Cancel and leaving the commit button unreachable (Jasper, 2026-10-22). - To have the note read with the commit button, give the note an
idand the buttonaria-describedby. - The × of
DialogCloseis labeled "Close". Passaria-labelto change it. - In a sheet the head puts × (or Back) first in the DOM, so Tab and a screen reader meet the head in the order it is seen: ×, the title, the commit button. The title stays the dialog's accessible name.
DialogSurfacehas no behavior of its own. The app that uses it must add thedialogrole,aria-modal, a name, the focus trap, Esc and the scrim.
Rules
- Put at most two buttons in the footer: Cancel first (
variant="ghost"), the confirm button last. They stay one row on a phone; only when they don't fit do they stack, the confirm button on top and Cancel framed. - The one exception is the prompt on closing or leaving with unsaved changes that can be saved straight from the prompt. It may have three buttons: Keep editing (
variant="ghost", first), Discard changes, then Save (variant="primary", last). With two, someone who wants to save has to keep editing, find Save and close again, and saving and leaving is what most people want there; the channel details do this (Jasper, 2026-11-14). A prompt that can't save directly keeps two buttons. It isn't a general rule: three buttons stack into three rows on a phone, and one exception shouldn't invite a secondary button in every dialog. The color of Discard changes is still open (Open questions). - Put at most one item at the start of the footer: a muted
TextLinkor aDialogFooterNote, never both. Never put an action that changes something there, and never something people need to decide; that goes in the body. - Use a
DialogFooterNoteonly in asize="lg"orsize="wide"dialog, and keep it to 40 characters: it never wraps on a desktop. - Build the footer from
DialogFooter, not a row of your own: it holds the spacing, the order and the stack when the buttons don't fit. - Make the confirm button pink (
variant="primary") when it does something. Color it by its consequence when it interrupts or can't be undone (AlertDialog). - Put anything people must read before they act in a Banner inside the body (Feedback).
- Pad every size by 20px. Its width comes from
size(Variants), never from a class of your own, except the exceptions listed there. - Don't pass
overlay={false}in product code: every centered dialog has the scrim, without exception.
API
Dialog
DialogBody
Also takes the attributes of its element.
DialogClose
Also takes the attributes of its element.
DialogCommit
Also takes the attributes of its element.
DialogContent
Also takes the attributes of its element.
DialogDescription
Also takes the attributes of its element.
DialogFooter, DialogHeader
Also takes the attributes of its element.
DialogNav
Also takes the attributes of its element.
DialogOverlay
Also takes the attributes of its element.
DialogPortal
Also takes the attributes of its element.
DialogSheetBack
Also takes the attributes of its element.
DialogSheetContent
Also takes the attributes of its element.
DialogSurface, DialogTitle
Also takes the attributes of its element.
DialogTrigger
Also takes the attributes of its element.
DialogFooterNote
Also takes the attributes of its element.
AnnouncementDialog
AnnouncementDialogTrigger
Also takes the attributes of its element.
AnnouncementDialogClose
Also takes the attributes of its element.
Related
Changes
- 0.107.0 · ChangedA phone sheet fits its content, up to 90% of the screen ([Dialog › The sheet](https://raft-design.botiverse.build/components/dialog/#the-sheet)): below 768px
DialogSheetContentis as tall as its content, capped at 90%, and a longer body scrolls inside. When the content changes height (the next step, a growing text box) the sheet animates to the new height over 200ms withease-slide; with reduced motion it changes at once. With the on-screen keyboard up, the sheet sits on the keyboard and is at most the space above it; a short sheet keeps its height. - 0.107.0 · ChangedA footer link in a phone sheet is a full-width outline button ([Dialog › The sheet](https://raft-design.botiverse.build/components/dialog/#the-sheet)): a
TextLinkwritten first inDialogFootermoves to the end of the sheet's body asButton variant="default" size="md", full width (32px tall, 44px hit area), instead of muted footnote text. - 0.105.1 · FixedPanel, PanelHeader, PanelFooter: inside a sheet (
DrawerContent, orDialogSheetContenton a phone) they paint the sheet'slayer-popoverinstead of their column'slayer-canvas, so the sheet is one surface from the grab handle down;PanelHeaderkeeps itsline-seam. ConversationPanelRoot, ConversationPanelFooter, ThreadPanelRoot and ThreadPanelFooter keeplayer-canvasin a sheet, so a conversation or a thread in a sheet changes only in its head (PanelHeader,ThreadPanelHeader). Beside the page they are unchanged. - 0.103.0 · Breaking ChangesExplanation slots take only a
HelperText:FieldDescription,FormSection'sdescription, aChoiceListitem'sdescription,SelectItemDescription,DialogDescription,AlertDialogDescription,DrawerDescription,PopoverDescription,EmptyStateDescription,CardDescription,CardFooter,BannerDescription,DialogFooterNote(work in progress),MessageActionCardHint,MessageActionCardHeaderDescription,MessageActionCardScopeDescriptionandMessageActionCardActionsNote. AHelperTextis made only byhelperText(content, { why, about }):contentis anyReactNode(a string, a formatted message, aTextLinkinside a sentence),whyis"consequence","audience"or"recovery", andaboutnames the thing the line is about. Each slot renders the content withdata-whyanddata-about, and in development warns once when it is given anything else, which it still renders.ToastDescription,NotificationCenterItemBody,EmptyStateTitle,ListRowDescriptionand the status and data parts are unchanged. - 0.103.0 · Changed
DialogBodyandAlertDialogBodydraw their text inforeground, notforeground-muted. - 0.99.0 · FixedWith
unstable_scrollArea,DialogBodyand a side drawer'sDrawerBodyscroll sideways to what is wider than they are ([Dialog › Scrolling in a ScrollArea](https://raft-design.botiverse.build/components/dialog/#scrolling-in-a-scrollarea), [Drawer › Scrolling in a ScrollArea](https://raft-design.botiverse.build/components/drawer/#scrolling-in-a-scrollarea)). The body is now a ScrollArea in both directions (orientation="both"): a child wider than the body (a wide table, a line that doesn't wrap, a<pre>, an image) is reached with a sideways wheel, a trackpad, a finger or the arrow keys, under a horizontal scrollbar along the body's bottom edge, over the footer. Where the two scrollbars meet each stops short of the corner. - 0.98.0 · AddedA side drawer's
DrawerBodycan scroll in a ScrollArea, with raft-ui's scrollbar in place of the platform's ([Drawer › Scrolling in a ScrollArea](https://raft-design.botiverse.build/components/drawer/#scrolling-in-a-scrollarea)). In a drawer from the right or the left,<DrawerBody unstable_scrollArea>renders a frame (data-slot="drawer-body-frame") around the body and binds the body as a ScrollArea with absolute gutters, asDialogBodydoes with the same prop. The body keepsdata-slot="drawer-body",className,ref, the native props,renderand its children, and is still the flex column they are laid out in, so a layout written on it (className="gap-4") is unchanged and its padding still scrolls with the content;wrapperClassNameis the frame's class, for the classes that size the body in the drawer (max-h-*,h-*,flex-*). The body is a Tab stop only while it overflows and holds nothing that takes focus (atabIndexof your own wins), so a form gains no stop and a long text that is only read can be scrolled with the keyboard, and a scroll stops at its end (overscroll="contain"). A bottom or top sheet ignores both props and renders the body as before. - 0.97.0 · Added
DialogBodycan scroll in a ScrollArea, with raft-ui's scrollbar in place of the platform's ([Dialog › Scrolling in a ScrollArea](https://raft-design.botiverse.build/components/dialog/#scrolling-in-a-scrollarea)).<DialogBody unstable_scrollArea>renders a frame (data-slot="dialog-body-frame") around the body and binds the body as a ScrollArea with absolute gutters. The body keepsdata-slot="dialog-body",className,ref, the native props and its children, so a layout written on it (className="grid gap-4") is unchanged;wrapperClassNameis the frame's class, for the classes that size the body in the dialog (max-h-*,h-*,flex-*). The body is a Tab stop only while it overflows and holds nothing that takes focus (atabIndexof your own wins), so a form gains no stop and a long text that is only read can be scrolled with the keyboard, and a scroll stops at its end with the bounce kept (overscroll="contain"). It works the same inDialogSheetContentbelow 768px. Abarbody ignores the prop.