MDK Logo
UI Kitreact-devkitComponentsCoreDialogs

DialogHeader

Top region of a `Dialog` that groups the title and description.

Top region of a <Dialog> that groups the title and description.

import { DialogHeader } from "@tetherto/mdk-react-devkit";
PropStatusTypeDefaultDescription
bareOptionalboolean | undefined
closableOptionalboolean | undefined
onCloseOptionalVoidFunction | undefined

Usage

A modal dialog built on Radix UI @radix-ui/react-dialog. Provides composable primitives plus a high-level DialogContent that handles the overlay, portal, title, description, and optional close button in one component.

Exports

NameDescription
DialogRoot compound component (Radix Root)
DialogTriggerElement that opens the dialog
DialogPortalRenders dialog into a portal
DialogOverlayDark backdrop
DialogContentPanel with built-in header, title, description, close button, and portal/overlay handling
DialogHeaderHeader container with optional close button
DialogTitleAccessible dialog title
DialogDescriptionAccessible description
DialogFooterFooter container
DialogCloseRaw Radix close primitive

DialogContent Props

PropTypeRequiredDefaultDescription
titlestringnoRenders DialogTitle (and optional DialogDescription) inside the header
descriptionstringnoRenders DialogDescription below the title
closablebooleannoShows an ✕ close button in the header
onCloseVoidFunctionnoFired when the ✕ button is clicked
barebooleannofalseApplies mdk-dialog__header--bare to the header
closeOnClickOutsidebooleannotrueWhether clicking the overlay closes the dialog
closeOnEscapebooleannotrueWhether pressing Escape closes the dialog
classNamestringnoAdditional class for the content panel

DialogHeader Props

PropTypeRequiredDefaultDescription
closablebooleannoRenders a close button
onCloseVoidFunctionnoFired when the close button is clicked
barebooleannofalseApplies bare header style

Notes

  • DialogContent omits aria-describedby automatically when no description is provided.
  • Use DialogTrigger for uncontrolled open state; use the open / onOpenChange props on Dialog for controlled usage.

Example

/** * Runnable example for Dialog. */import { useState } from 'react'import {  Button,  Dialog,  DialogContent,  DialogFooter,  DialogTrigger,} from '@tetherto/mdk-react-devkit'export const DialogExample = () => {  const [open, setOpen] = useState(false)  return (    <div className="mdk-example-row">      <Dialog>        <DialogTrigger asChild>          <Button variant="secondary">Open Dialog</Button>        </DialogTrigger>        <DialogContent          title="Device Settings"          description="Adjust configuration for this miner."          closable        >          <p>Dialog body content goes here. Add form fields, tables, or any content.</p>          <DialogFooter>            <Button variant="secondary">Cancel</Button>            <Button variant="primary">Save Changes</Button>          </DialogFooter>        </DialogContent>      </Dialog>      <Dialog open={open} onOpenChange={setOpen}>        <DialogTrigger asChild>          <Button variant="primary">Controlled Dialog</Button>        </DialogTrigger>        <DialogContent          title="Confirm Action"          closable          onClose={() => setOpen(false)}          closeOnClickOutside={false}        >          <p>This dialog cannot be dismissed by clicking outside.</p>          <DialogFooter>            <Button variant="secondary" onClick={() => setOpen(false)}>              Close            </Button>          </DialogFooter>        </DialogContent>      </Dialog>    </div>  )}