Skip to content

Dialog

Controlled/uncontrolled modal backed by React Native core Modal, with a real Web focus trap and Escape dismissal.

  • Category: Overlays & feedback
  • Status: stable public Registry/export-map component family
  • Targets: iOS · Android · Web, subject to the compatibility contract
  • Prerequisites: @beemvp/beeui-ui installed (or this component’s source copied via the Registry CLI below) and, on Web, the BeeUI Tailwind/Uniwind theme CSS loaded — see Start for full platform setup.
  • Source: packages/ui/src/components/dialog.tsx
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger } from '@beemvp/beeui-ui';

There is no documented deep/private source import. For source ownership from a BeeUI checkout:

Terminal window
pnpm beeui add dialog

Registry (used throughout this page) is BeeUI’s source-ownership manifest — registry/registry.json — that the pnpm beeui/@beemvp/beeui-cli CLI reads to copy a component’s real source into your app and rewrite its internal imports; it is not an npm package index. This component’s own Registry entry: registry/registry.json.

  • Family exports: Dialog DialogClose DialogContent DialogDescription DialogFooter DialogTitle DialogTrigger
    • Also routed here, outside the Registry family:
      • dialog
    • Package export subpath: @beemvp/beeui-ui/dialog

Exported types: DialogCloseProps, DialogContentProps, DialogDescriptionProps, DialogFooterProps, DialogProps, DialogTitleProps, DialogTriggerProps

The generated API inventory is mechanically joined to packages/ui/src/index.ts, Registry metadata, and the component reference contract. Each type’s field table below is parsed directly from that source, not a second hand-maintained copy; for the fuller behavior narrative see the canonical component behavior catalog.

Controlled (open+onOpenChange, defaultOpen forbidden) or uncontrolled (defaultOpen, open forbidden) modal state; supplying open without onOpenChange warns in development and falls back to dismissable behavior. Backdrop press, Web Escape, and Android hardware back all route through one close policy, while dismissOnRequestClose={false}/dismissOnEscape={false} opt individual channels out.

DialogCloseProps is exactly ButtonProps.

Prop Type Default Description
children React.ReactNode — Content rendered inside this element. The family’s composition section states which children it expects.
className string — Extra utility classes, merged after the component’s own via cn(...), so they win on conflict. An escape hatch for source-owned and application work, not a cross-engine portability guarantee.
labelClassName string — Extra utility classes for the label text specifically, merged after the component’s own.
loading boolean false Shows a spinner in place of the label, sets aria-busy, and disables presses. Defaults to false.
size 'sm' | 'md' | 'lg' | 'icon' 'md' Chooses this element’s size from buttonVariants’s presets, declared in packages/ui/src/components/button.tsx — the classes each value applies are there.
variant 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive' 'primary' Chooses this element’s variant from buttonVariants’s presets, declared in packages/ui/src/components/button.tsx — the classes each value applies are there.

Also carries every prop of Omit<PressableProps, 'accessibilityRole' | 'role' | 'children'> — that upstream contract is not reproduced here.

Prop Type Default Description
closeOnBackdropPress boolean true Whether pressing the dimmed backdrop behind the panel closes the dialog. Defaults to true.
containerClassName string — Extra utility classes for the overlay’s container element, merged after the component’s own.
dismissOnEscape boolean true Web only: whether a physical Escape keypress closes this dialog. Defaults to true. Independent from dismissOnRequestClose, which governs native request-close sources (Android hardware back, iOS/other native modal dismissal) that do not exist on Web — AlertDialogContent sets this false to keep its documented “Escape never dismisses” contract regardless of cancelOnRequestClose.
dismissOnRequestClose boolean true Whether native request-close sources (Android hardware back, iOS/other native modal dismissal, and — on Web — the RN Modal internal Escape shim) close the dialog. Defaults to true. AlertDialogContent maps this to its cancelOnRequestClose prop.
modalProps DialogModalProps — Forwarded to the underlying React Native Modal, minus the props this component already controls (animationType and presentationStyle may still be overridden here).
onRequestClose () => void — Called whenever a request-close source fires, before this dialog applies its own dismissOnRequestClose/dismissOnEscape policy. Does not by itself close the dialog.
overlayClassName string — Extra utility classes for the backdrop element behind the surface, merged after the component’s own.
overlayProps Omit<PressableProps, 'children' | 'onPress'> — Forwarded to the backdrop Pressable, excluding children and onPress which this component owns.
overlayTestID string — testID applied to the backdrop Pressable, for targeting it in tests.

Also carries every prop of Omit<ViewProps, 'accessibilityRole' | 'accessibilityViewIsModal' | 'role'> — that upstream contract is not reproduced here.

This type adds no fields of its own. These are the props the implementation reads from the base type below; everything else is passed straight through.

Prop Default
accessibilityLabel —
children —
className —
nativeID —

Also carries every prop of Omit<TextProps, 'tone' | 'variant'> — documented on the Text page, not reproduced here.

Prop Type Default Description
className string — Extra utility classes, merged after the component’s own via cn(...), so they win on conflict. An escape hatch for source-owned and application work, not a cross-engine portability guarantee.

Also carries every prop of ViewProps — that upstream contract is not reproduced here.

one of the following mutually exclusive variants:

Variant DialogControlledProps:

Prop Type Default Description
children React.ReactNode — Content rendered inside this element. The family’s composition section states which children it expects.
defaultOpen never false Not accepted in the controlled variant, where open already owns the state. Pass defaultOpen on its own, without open, to use the uncontrolled variant.
onOpenChange (required) (open: boolean) => void — Applies a requested open state, and is required here because the controlled variant never updates its own visibility. If this does not change open, nothing does.
open (required) boolean — Current open state, owned by the caller; supplying a defined value alongside onOpenChange is what selects the controlled variant. Passing open without an onOpenChange function warns in development and falls back to uncontrolled behavior.

Variant DialogUncontrolledProps:

Prop Type Default Description
children React.ReactNode — Content rendered inside this element. The family’s composition section states which children it expects.
defaultOpen boolean false Open state to start from, read once when the component mounts, so later changes to it are ignored. Defaults to false; drive visibility with open + onOpenChange instead when it needs to change.
onOpenChange (open: boolean) => void — Notified after the open state changes, and optional here because the uncontrolled variant updates its own state either way.
open undefined — Must be left undefined in the uncontrolled variant, because a defined open together with onOpenChange selects the controlled variant instead.

This type adds no fields of its own. These are the props the implementation reads from the base type below; everything else is passed straight through.

Prop Default
accessibilityLabel —
children —
className —
nativeID —

Also carries every prop of Omit<TextProps, 'accessibilityRole' | 'role' | 'variant'> — documented on the Text page, not reproduced here.

DialogTriggerProps is exactly ButtonProps.

Prop Type Default Description
children React.ReactNode — Content rendered inside this element. The family’s composition section states which children it expects.
className string — Extra utility classes, merged after the component’s own via cn(...), so they win on conflict. An escape hatch for source-owned and application work, not a cross-engine portability guarantee.
labelClassName string — Extra utility classes for the label text specifically, merged after the component’s own.
loading boolean false Shows a spinner in place of the label, sets aria-busy, and disables presses. Defaults to false.
size 'sm' | 'md' | 'lg' | 'icon' 'md' Chooses this element’s size from buttonVariants’s presets, declared in packages/ui/src/components/button.tsx — the classes each value applies are there.
variant 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive' 'primary' Chooses this element’s variant from buttonVariants’s presets, declared in packages/ui/src/components/button.tsx — the classes each value applies are there.

Also carries every prop of Omit<PressableProps, 'accessibilityRole' | 'role' | 'children'> — that upstream contract is not reproduced here.

This is the pressable itself — the same variant/size/press API as Button — so icon/label children go directly inside it. Do not nest a second pressable (an icon button, or an avatar wrapped for press) inside a *Trigger: on Web that renders one interactive element inside another, which React flags as invalid DOM nesting. For an icon-only or avatar trigger, set variant="ghost" (and size/className as needed) on the trigger itself instead of wrapping a second pressable.

The executable fixtures below are the source-grounded usage examples; consumers should not infer state ownership from DOM structure or another UI library.

  • BeeUIProvider is required above this family because it participates in shared overlay/toast runtime infrastructure.
  • Peer/native dependencies visible to this Registry item: react, react-native
  • Registry dependency closure: button, core-cn, overlay-runtime, text, theme
  • Safe-area ownership remains explicit: shell surfaces touching system edges opt into SafeArea; components do not silently invent app-shell insets.
  • Web consumers load the BeeUI semantic theme CSS as documented in Web onboarding.

This family ships no platform-specific file, but its source branches on Platform, so some behavior differs by target.

The same public family is exposed across the supported target matrix; meaningful platform differences remain governed by the compatibility contract.

Evidence classes are not equal and this page does not blur them: Web behavior is exercised in a real browser, while iOS and Android carry package/export and native-compile evidence, which is not device-runtime proof. The compatibility contract records which class each claim rests on.

  • Roles this family assigns: header — set in dialog.tsx by the components themselves, not by the caller.
  • Accessibility states and properties it sets: accessibilityHint, accessibilityLabel, accessibilityLabelledBy, accessible, hidden, modal — read from dialog.tsx.

Keyboard/focus behavior, announcements, Dynamic Type/Web zoom, RTL and reduced-motion expectations are not derived here — see Accessibility overview, Keyboard & focus, RTL/localization and Large text & zoom. BeeUI does not claim universal accessibility certification from automated tests.

  • Style axes: size (4 values), variant (5 values), tone (8 values, inherited from TextProps).
  • Class-name surfaces: className, containerClassName, labelClassName, overlayClassName.

Colors, spacing and typography come from semantic tokens rather than from values written here — see Theming and Density. A className is an escape hatch for source-owned and application work, not a cross-engine portability guarantee.

Each link below opens the Showcase at that exact example, not at the top of the gallery:

  • basic — smallest meaningful complete usage

The Showcase links demonstrate Web behavior; use the native-preview guide for real simulator/emulator/device paths.

This frame loads the real BeeUI Web Showcase on demand; it is not a second docs-only implementation. It proves browser behavior only. Use native preview for iOS/Android simulator, emulator or device paths.

  • Family root / primary export: Dialog
    • Public composition parts / helpers:
      • DialogClose
      • DialogContent
      • DialogDescription
      • DialogFooter
      • DialogTitle
      • DialogTrigger
    • Exported type surface:
      • DialogCloseProps
      • DialogContentProps
      • DialogDescriptionProps
      • DialogFooterProps
      • DialogProps
      • DialogTitleProps
      • DialogTriggerProps

The tree above is ordinary document structure so it remains readable with keyboard and assistive technology; it is derived from the real public export family rather than a canvas-only diagram.

These are the parts of the typechecked runtime Showcase fixture behind this live preview — apps/showcase/component-gallery/component-gallery.tsx, 1103 lines — where Dialog is actually used: 81 lines in 4 places. Each block is copied verbatim from the line range named above it, so it is the same executable source, not a retelling of it. The rest of that file exercises other families and is not reproduced here.

Imports the examples below need (a filtered subset of the fixture’s own top-level imports):

import { BeeThemeScope, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger, Field, Input, Popover, PopoverContent, PopoverTrigger, Text, Tooltip, TooltipContent, TooltipTrigger } from '@beemvp/beeui-ui';
import * as React from 'react';
import { useUniwind } from 'uniwind';

Fixture state this block reads (same file, lines 174, 176-178, 189, 190):

const OverlayConsumerContext = React.createContext('overlay-context-default');
function OverlayContextValue({ testID }: { testID: string }) {
return <Text testID={testID}>{`context: ${React.useContext(OverlayConsumerContext)}`}</Text>;
}
const [dialogOpen, setDialogOpen] = React.useState(false);
const [menuOpen, setMenuOpen] = React.useState(false);

lines 215–229:

<Dialog onOpenChange={setDialogOpen} open={dialogOpen}>
<DialogTrigger testID="overlay-context-casec-dialog-trigger">CASE C dialog</DialogTrigger>
<DialogContent>
<DialogTitle>CASE C dialog</DialogTitle>
<DropdownMenu onOpenChange={setMenuOpen} open={menuOpen}>
<DropdownMenuTrigger testID="overlay-context-casec-menu-trigger" variant="outline">
CASE C menu
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuLabel>CASE C menu</DropdownMenuLabel>
<OverlayContextValue testID="overlay-context-casec-menu-value" />
</DropdownMenuContent>
</DropdownMenu>
</DialogContent>
</Dialog>

Fixture state this block reads (same file, lines 174, 176-178, 235):

const OverlayConsumerContext = React.createContext('overlay-context-default');
function OverlayContextValue({ testID }: { testID: string }) {
return <Text testID={testID}>{`context: ${React.useContext(OverlayConsumerContext)}`}</Text>;
}
const [dialogMenuAction, setDialogMenuAction] = React.useState('none');

lines 268–307:

<Dialog>
<DialogTrigger testID="overlay-context-dialog-trigger">Dialog context</DialogTrigger>
<DialogContent>
<DialogTitle>Dialog with a nested overlay</DialogTitle>
<Popover>
<PopoverTrigger testID="overlay-context-dialog-popover-trigger" variant="outline">
Popover in dialog
</PopoverTrigger>
<PopoverContent placement="bottom">
<OverlayContextValue testID="overlay-context-dialog-popover-value" />
</PopoverContent>
</Popover>
<Tooltip>
<TooltipTrigger testID="overlay-context-dialog-tooltip-trigger" variant="outline">
Tooltip in dialog
</TooltipTrigger>
<TooltipContent>
<OverlayContextValue testID="overlay-context-dialog-tooltip-value" />
</TooltipContent>
</Tooltip>
<DropdownMenu>
<DropdownMenuTrigger testID="overlay-context-dialog-menu-trigger" variant="outline">
Menu in dialog
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuLabel>Menu in dialog</DropdownMenuLabel>
<OverlayContextValue testID="overlay-context-dialog-menu-value" />
<DropdownMenuItem
onSelect={() => setDialogMenuAction('selected')}
testID="overlay-context-dialog-menu-item"
>
Select in dialog
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<Text testID="overlay-context-dialog-menu-action">{`menu action: ${dialogMenuAction}`}</Text>
</DialogContent>
</Dialog>

Fixture state this block reads (same file, line 321-324):

function ThemeScopeValue({ testID }: { testID: string }) {
const { theme } = useUniwind();
return <Text testID={testID}>{`theme: ${theme}`}</Text>;
}

lines 353–362:

<Dialog>
<DialogTrigger testID="theme-scope-dialog-trigger">Dialog in scope</DialogTrigger>
<DialogContent>
<DialogTitle>Dialog inside a BeeThemeScope</DialogTitle>
<ThemeScopeValue testID="theme-scope-dialog-value" />
<DialogClose size="sm" variant="ghost">
Close
</DialogClose>
</DialogContent>
</Dialog>

lines 715–730:

<Dialog>
<DialogTrigger>Open Dialog</DialogTrigger>
<DialogContent>
<DialogTitle>Project settings</DialogTitle>
<DialogDescription>
This is BeeUI's centered modal surface. Backdrop, accessibility escape, and native request-close follow the Dialog contract.
</DialogDescription>
<Field label="Project name">
<Input defaultValue="BeeUI" />
</Field>
<DialogFooter>
<DialogClose variant="outline">Cancel</DialogClose>
<DialogClose>Save changes</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>

Open the fixture itself for the full surrounding component. For a smaller app-specific example, start from the imports and fixture-state blocks above and keep only the state your screen owns.

Controlled open requires onOpenChange.