Skip to Content
ComponentsDialog

Dialog

A Dialog is a graphical control element in the form of a small panel that communicates information and prompts for a response.

GitHub LogoSource Code

Maximum width

Use the maxWidth prop to set the maximum width of the dialog. The width of the dialog will adjust automatically to the width of the content, unless the prop fullWidth is set to true in which case the dialog will grow to occupy the width specified on maxWidth.

Semantic

The HvDialog component can receive a variant prop to set the status of the dialog. HvDialogTitle also accepts a variant prop that changes the icon.

Long content

With very long content the dialog grows in height, up to a maximum where a margin of 100px is left on top and bottom.

Furthermore, dialogs that require explicit user acknowledgment, shouldn’t be easily dismissible. This can be achieved by NOT providing the onClose prop, which removes the ability to dismiss the dialog using the close “X” button, ESC, or background click.

Fullscreen

The HvDialog component can receive a fullscreen prop to make it fullscreen.

Alert Dialog

This example demonstrates using a form in HvDialog. The sample uses the autoFocus attribute to focus the Title input by default. Accessibility-wise, HvDialogTitle automatically labels the dialog. An aria-describedby can be used to describe the content. Dialogs with forms typically behave as alert dialogs, and shouldn’t provide an onClose.

Form data:

{}
Last updated on