Actions

Result Dialog

A modal report of an action's outcome in one of daisyUI's colors, with one OK button and an optional automatic close.

Class nameTypeDescription
result-dialogplf:result-dialogComponentOn a Modal dialog, beside modal
result-dialog-iconplf:result-dialog-iconPartThe round icon box, where a color draws its icon
result-dialog-svgplf:result-dialog-svgPartYour own SVG in the box, in place of the color's icon; an icon class there doesn't need it
result-dialog-titleplf:result-dialog-titlePartThe dialog's heading
result-dialog-descriptionplf:result-dialog-descriptionPartMuted text under the title
result-dialog-footerplf:result-dialog-footerPartThe OK button's row
result-dialog-contentplf:result-dialog-contentPartThe scrolling content the script adds for an automatic close
result-dialog-countdownplf:result-dialog-countdownPartThe time-left line the script adds
result-dialog-borderplf:result-dialog-borderPartThe countdown's SVG the script adds
result-dialog-border-pathplf:result-dialog-border-pathPartThe line that traces the border
result-dialog-successplf:result-dialog-successColorA completed action; its check draws itself on each opening
result-dialog-errorplf:result-dialog-errorColorA failed action
result-dialog-warningplf:result-dialog-warningColorA result that needs attention
result-dialog-infoplf:result-dialog-infoColorA neutral notice

Default

Result Dialog reports an outcome and runs no action itself; to ask before an action, use Alert Dialog.

Changes saved

Your profile is up to date.

Could not save changes

Check your connection and try again.

Saved with warnings

Two images were too large and were skipped.

Export started

The file will be ready in a few minutes.

Automatic close

Choose a duration long enough to read the content, and keep errors open until OK.

Draft published

This message closes on its own.

After a request

Open it from your code once a request finishes, such as a form submit, with PLF.Modal.getOrCreateInstance(dialog).open(button); focus returns to that button when it closes.

Email updated

We sent a confirmation link to your new address.

JavaScript

Result Dialog needs JavaScript. The Full script (pelatform-ui.min.js) starts every component on page load, with no code of your own; with ESM imports, call init() yourself, as in Installation. For markup you add later, see Dynamic content.

<link rel="stylesheet" href="pelatform-ui.min.css">
<script src="pelatform-ui.min.js" defer></script>
<link rel="stylesheet" href="pelatform-ui.prefixed.min.css">
<script src="pelatform-ui.min.js" defer></script>

From a script, PLF.Dialog.fire() shows any outcome with SweetAlert’s options, on a dialog it creates: see Dialogs from JavaScript.

Hooks

Attribute Purpose
data-plf-result-dialog Marks a Modal dialog as a result dialog, with one OK button
data-plf-auto-close Optional duration in milliseconds, from 1000 to 2147483647, read on each opening; a line traces the border and the dialog closes when it completes. Hover and focus pause it; OK and Escape close it at any time

Methods and events

Result Dialog uses the Modal methods, events and keyboard; an automatic close fires them with reason: "api".

React

ResultDialog from @pelatform/react renders this dialog on a Modal: the application opens it with open and closes it in onOpenChange, and each part is a component of its own.

Prop Values Default
open true while the dialog is open Required
onOpenChange (open, reason), called when the dialog asks to close: trigger (OK), keyboard (Escape) or timer (the automatic close); keep open to stay open None
color success, error, warning, info None
duration Milliseconds before an automatic close, at least 1000; a line traces the border, and hover and focus pause it None

The parts:

Part Element
ResultDialogIcon A span with result-dialog-icon: empty, the color’s icon; an Icon inside takes its place
ResultDialogTitle An h2 with result-dialog-title, or another heading with level, which names the dialog
ResultDialogDescription A p with result-dialog-description, which describes the dialog
ResultDialogFooter A div with result-dialog-footer
ResultDialogAction The OK button: a Button, primary unless given another color, which closes with trigger

Other props are the element’s own, className and ref included. To show a result from your code without this markup, use useDialog().

CSS variables

The surface, padding, radius and backdrop come from the Modal variables.

Variable Default
--plf-result-dialog-width 24rem, capped to the viewport
--plf-result-dialog-icon-bg The color’s background; --plf-color-surface-muted without a color
--plf-result-dialog-icon-color The color’s text; --plf-color-text without a color
--plf-result-dialog-progress-color The color, for the automatic-close line; --plf-color-primary without a color

Built with Pelatform UIv0.1.0

Components

Getting started

Foundations

Components

Actions

Data display

Navigation

Feedback

Data input

Layout

Advanced

Integrations

Blocks

Application

Authentication

Icons