Skip to content
Harness Design System Harness Design System Harness Design System

Dialog

beta

The Dialog component provides an accessible and customizable dialog overlay for displaying important content or requesting user input. It supports different sizes, themes, and can include an icon or logo in the header.

Usage

import { Dialog } from "@harnessio/ui/components";
// ...
return (
<Dialog.Root>
<Dialog.Trigger asChild>
<Button>Open Dialog</Button>
</Dialog.Trigger>
<Dialog.Content size="md">
<Dialog.Header icon="plus-circle">
<Dialog.Title>Dialog Title</Dialog.Title>
<Dialog.Description>Optional description text</Dialog.Description>
</Dialog.Header>
<Dialog.Body>
Dialog content goes here
</Dialog.Body>
<Dialog.Footer>
<Dialog.Close>Cancel</Dialog.Close>
<Button variant="primary">Confirm</Button>
</Dialog.Footer>
</Dialog.Content>
</Dialog.Root>
)

Sizes

The Dialog component supports three sizes: sm, md, and lg:

Themes

Headers can have themes default, warning and danger with matching icons:

With Logo/Icon

Headers can display a logo or an icon:

Hidden Close Button

You can hide the close button in the top-right corner using the hideClose prop:

Scrollable Content

The Body component automatically handles scrolling for long content:

Anatomy

All parts of the Dialog component can be imported and composed as required.

<Dialog.Root>
<Dialog.Trigger />
<Dialog.Content>
<Dialog.Header>
<Dialog.Title />
<Dialog.Description />
</Dialog.Header>
<Dialog.Body />
<Dialog.Footer>
<Dialog.Close />
</Dialog.Footer>
</Dialog.Content>
</Dialog.Root>

API Reference

Root

Controls the open/close behavior of the modal.

Prop
Required
Default
Type
openfalseboolean
onOpenChangefalse(open: boolean) => void
childrentrueReactNode

Content

The main content container of the dialog.

Prop
Required
Default
Type
sizefalse'sm''sm' | 'md' | 'lg'
hideClosefalsefalseboolean
classNamefalsestring
childrentrueReactNode

The header section of the dialog, containing the title and optional description.

Prop
Required
Default
Type
iconfalsestring
logofalsestring
themefalse'default''default' | 'warning' | 'danger'
classNamefalsestring
childrentrueReactNode

Title

The title text component for the dialog header.

Prop
Required
Default
Type
classNamefalsestring
childrentrueReactNode

Description

Optional description text below the title.

Prop
Required
Default
Type
classNamefalsestring
childrentrueReactNode
Prop
Required
Default
Type
classNamefalsestring
childrentrueReactNode

Body

Main scrollable content area of the dialog.

Prop
Required
Default
Type
classNamefalsestring
childrentrueReactNode
Prop
Required
Default
Type
classNamefalsestring
childrentrueReactNode

Footer section for actions (e.g., buttons).

Prop
Required
Default
Type
classNamefalsestring
childrentrueReactNode
Prop
Required
Default
Type
classNamefalsestring
childrentrueReactNode

Close

Can be used inside Footer or as a standalone button to close the modal.

Prop
Required
Default
Type
classNamefalsestring
childrentrueReactNode