Docyrus

AwesomeDialog

Compound dialog rendered as a centred modal, an edge sheet or a swipe-to-dismiss drawer, with pattern chrome, header avatar / icon, toolbar menus, fullscreen and minimise-to-bar.

iOSAndroid
Preview AwesomeDialog on your device

Scan with Expo Go

Download Expo Go, then scan the QR code to preview native components.

Installation

pnpm dlx @docyrus/cli add @docyrus/rn-awesome-dialog
Required Packages(4 packages)
pnpm add react-native-svg react-native-reanimated react-native-gesture-handler react-native-safe-area-context

Usage

import {
  AwesomeDialog,
  AwesomeDialogHeader,
  AwesomeDialogBody,
  AwesomeDialogFooter,
} from '@/components/docyrus-native/awesome-dialog';

const [open, setOpen] = useState(false);

<AwesomeDialog open={open} onOpenChange={setOpen} size="lg">
  <AwesomeDialogHeader title="Edit record" description="Changes are saved on confirm" icon="fal pen" />
  <AwesomeDialogBody>
    <Text>Dialog content</Text>
  </AwesomeDialogBody>
  <AwesomeDialogFooter>
    <Button variant="outline" onPress={() => setOpen(false)}>Cancel</Button>
    <Button onPress={() => setOpen(false)}>Save</Button>
  </AwesomeDialogFooter>
</AwesomeDialog>

Containers

{/* Edge sheet (no swipe) */}
<AwesomeDialog container="sheet" side="right" open={open} onOpenChange={setOpen}>…</AwesomeDialog>

{/* Drawer — swipe towards its edge to dismiss (top / bottom: swipe the grab handle) */}
<AwesomeDialog container="drawer" side="bottom" open={open} onOpenChange={setOpen}>…</AwesomeDialog>

preventOutsideClose ignores backdrop taps on every container; on the drawer it also disables swipe-to-dismiss and the Android back button.

Header avatar and icon

<AwesomeDialogHeader
  title="Acme Inc."
  avatar={{ color: 'indigo-500', icon: 'fal building' }} />

<AwesomeDialogHeader title="Report" icon="chart-pie" iconLib="fal" />

Toolbar menus

Web's desktop menubar becomes a horizontal chip row; each chip opens its actions in an ActionSheet. Separators are dropped and shortcut hints are not shown.

<AwesomeDialogToolbar
  menus={[
    { label: 'File', items: [{ label: 'Save', onClick: save }, { label: 'Archive', disabled: true }] },
    { label: 'Edit', items: [{ label: 'Undo', onClick: undo }] },
  ]} />

Minimise to a global bar

Wrap the app in GlobalDialogProvider, mount one GlobalDialogBar, and give a dialog minimizable + a dialogId. Minimising hides the dialog (its open stays true) and docks a pill in the bar; tapping the pill restores it, the × closes it (calls the dialog's onOpenChange(false)).

<GlobalDialogProvider persist>
  <App />
  <GlobalDialogBar className="bottom-24" /> {/* above a tab bar */}
</GlobalDialogProvider>

<AwesomeDialog dialogId="invoice-42" minimizable open={open} onOpenChange={setOpen}>…</AwesomeDialog>

persist stores minimised / fullscreen states in the synchronous 'local' Docyrus key-value store (lib/storage — register a backend with DocyStorageProvider; without one it lives in memory for the process lifetime).

Native differences from web: side defaults to 'bottom' (web: 'right'); resizable is accepted but ignored (pointer-only); the root title is a native fallback used by AwesomeDialogHeader when it has no title and no children; header icon also accepts a ReactNode; the global registry merges repeat register() calls and adds close(id).

API Reference

AwesomeDialogProps

PropTypeDefaultDescription
openbooleanfalseControlled open state
onOpenChange(open: boolean) => void-Open state change handler
childrenReactNode-Dialog content (Header / Toolbar / Body / Footer)
container'modal' | 'sheet' | 'drawer''modal'Centred modal, edge sheet, or edge drawer with swipe-to-dismiss
side'left' | 'right' | 'top' | 'bottom''bottom'Edge for sheet / drawer containers
size'sm' | 'default' | 'lg' | 'xl' | 'full''default'Size preset
patternbooleantrueShow the SVG pattern background
patternStyle'stripes' | 'dots' | 'grid' | 'crosshatch' | 'zigzag''stripes'Pattern motif
resizablebooleanfalseAccepted for web parity; ignored on native
fullscreenablebooleanfalseShow the maximize / restore button in the header
defaultFullscreenbooleanfalseStart in fullscreen mode
minimizablebooleanfalseShow the minimize button (needs GlobalDialogProvider + dialogId)
preventOutsideClosebooleanfalseIgnore backdrop taps (and swipe / back button for the drawer)
dialogIdstring-Unique ID for GlobalDialogProvider tracking
titlestring-Fallback title for AwesomeDialogHeader (native only)
classNamestring-Classes for the inner dialog card

Size Presets

SizeModal (width / max height)Top / bottom panel heightLeft / right panel width
sm75% / 50%35%50%
default85% / 70%50%65%
lg92% / 85%70%80%
xl96% / 92%85%90%
full100% / 100%100%100%

AwesomeDialogHeaderProps

PropTypeDefaultDescription
titlestringroot titleDialog title text
descriptionstring-Text below the title
iconstring | ReactNode-DocyrusIcon identifier (or a custom node)
iconLibstring-DocyrusIcon library
avatar{ name?: string; color?: string; icon?: string; image?: string }-Rendered through AvatarThumbnail (image is a URL)
closablebooleantrueShow the close button
headerButtonsReactNode-Buttons rendered before the built-in ones
onClose() => void-Custom close handler (defaults to onOpenChange(false))
childrenReactNode-Custom content shown in place of the title when no title is set
classNamestring-Additional CSS classes

AwesomeDialogToolbarProps

PropTypeDefaultDescription
menusToolbarMenuItem[]-Menu chips, each opening an action sheet
childrenReactNode-Custom toolbar content (after the chips)
classNamestring-Classes for the chip row content

ToolbarMenuItem / ToolbarMenuAction

FieldTypeDescription
ToolbarMenuItem.labelstringChip label / sheet title
ToolbarMenuItem.itemsToolbarMenuAction[]Actions
ToolbarMenuAction.labelstringAction label
ToolbarMenuAction.onClick() => voidCalled when picked
ToolbarMenuAction.disabledbooleanGreys the row out
ToolbarMenuAction.separatorbooleanDropped on native
ToolbarMenuAction.shortcutstringWeb parity; not shown on native

AwesomeDialogBodyProps / AwesomeDialogFooterProps

PropTypeDefaultDescription
childrenReactNode-Content (the body scrolls)
classNamestring-Additional CSS classes (body: scroll content container)

AwesomeDialogContentProps

The patterned two-layer surface AwesomeDialog renders around its children; use it only when composing a custom container.

PropTypeDefaultDescription
childrenReactNode-Dialog parts
patternbooleantrueShow the pattern
patternStylePatternStyle'stripes'Pattern motif
isFullscreenbooleanfalseDrop the frame padding / radius
classNamestring-Classes for the inner card

GlobalDialogProviderProps

PropTypeDefaultDescription
childrenReactNode-App subtree
persistbooleanfalsePersist minimised / fullscreen states to the 'local' Docyrus store
storageKeystring'awesome-dialog-states'Storage key

GlobalDialogBarProps

PropTypeDefaultDescription
classNamestring-Positioning overrides (defaults to absolute bottom-4 left-4 right-4)

Hooks

HookReturnsDescription
useAwesomeDialog()AwesomeDialogContextValueDialog state (container, side, size, isFullscreen, setFullscreen, toggleFullscreen, fullscreenable, minimizable, resizable, onClose, dialogId, title, fillsHeight). Throws outside an AwesomeDialog
useGlobalDialog()GlobalDialogContextValueGlobal registry (dialogs, register, unregister, minimize, restore, bringToFront, toggleFullscreen, getZIndex, isMinimized, isFullscreen, minimizedDialogs, close). Throws outside the provider
useOptionalGlobalDialog()GlobalDialogContextValue | nullSame, null without a provider

Components

ComponentDescription
AwesomeDialogRoot (container, sizing, global registration)
AwesomeDialogHeaderTitle / description / icon / avatar + fullscreen, minimize and close buttons
AwesomeDialogToolbarMenu chip row
AwesomeDialogBodyScrollable content
AwesomeDialogFooterAction row
AwesomeDialogContentPatterned surface (rendered by the root)
GlobalDialogProviderRegistry for minimisable dialogs
GlobalDialogBarFloating pill stack of minimised dialogs

Type Exports

TypeDescription
AwesomeDialogPropsRoot props
AwesomeDialogHeaderPropsHeader props
AwesomeDialogHeaderAvatarHeader avatar config
AwesomeDialogBodyPropsBody props
AwesomeDialogFooterPropsFooter props
AwesomeDialogToolbarPropsToolbar props
AwesomeDialogContentPropsContent surface props
AwesomeDialogContextValueuseAwesomeDialog() value
DialogContainer'modal' | 'sheet' | 'drawer'
DialogSide'left' | 'right' | 'top' | 'bottom'
DialogSize'sm' | 'default' | 'lg' | 'xl' | 'full'
DialogStateRegistry entry (dialogId, minimized, fullscreen, zIndex, title?, icon?)
GlobalDialogContextValueRegistry API
GlobalDialogProviderPropsProvider props
GlobalDialogRegisterMetaregister() meta (title?, icon?, onClose?)
GlobalDialogBarPropsBar props
ToolbarMenuItemToolbar menu
ToolbarMenuActionToolbar menu action
PatternStylePattern motif union
AwesomeDialogSize / AwesomeDialogContainer / AwesomeDialogSheetSideDeprecated aliases of DialogSize / DialogContainer / DialogSide

On this page