Dialog types

Various ways to serve and input data.

A Kirigami.Dialog is a simple component that you can use to supplement the content being displayed on an application's page. It can display non-interactive content (only text) and interactive content (forms, listviews and buttons).

They can be dismissed by clicking or tapping outside of their area or by clicking the close button on the header.

Dialog

A standard Kirigami.Dialog is used to create custom dialogs. They are very easy to extend:

import QtQuick
import QtQuick.Controls as Controls
import org.kde.kirigami as Kirigami

Kirigami.ApplicationWindow {
    title: "Dialog"
    width: 400
    height: 400
    pageStack.initialPage: Kirigami.Page {
        id: page
        actions: Kirigami.Action {
            icon.name: "list-add"
            text: "Show dialog"
            onTriggered: dialog.open()
        }

        Kirigami.Dialog {
            id: dialog
            title: "A simple dialog"
            padding: Kirigami.Units.largeSpacing
            showCloseButton: false
            standardButtons: Kirigami.Dialog.NoButton
            flatFooterButtons: false
            Controls.Label {
                text: "A generic, easy to make dialog!"
            }
            customFooterActions: Kirigami.Action {
                text: "Copy"
                icon.name: "clipboard"
            }
        }
    }
}
Simple dialog containing only text

As shown in the introduction tutorial about dialogs, it is also possible to capture a standardButton(button) to assign some behavior to it, like a binding to enable it only under certain conditions.

This type of dialog is generic and applies to most use cases, and it works well with complex interactive content (especially views):

A simple scrollable dialog

In most cases however you will likely want to use one of its derived dialog types, Kirigami.PromptDialog or Kirigami.MenuDialog.

PromptDialog

A Kirigami.PromptDialog is essentially a dialog with a built-in label and default contentPadding that is used to prompt the user for some information. This type of dialog is supposed to be used only for simple yes/no prompts or brief requests for user input.

Its main property is Kirigami.Dialog.subtitle, to which you would add text. If any QML component is added as a child of the prompt dialog, that component will take the place of the subtitle instead, and this can be explicitly specified with Kirigami.Dialog.mainItem.

A simple prompt dialog containing only text
A PromptDialog with a custom TextField

The Kirigami.MenuDialog is a specialized dialog that is used to list a selection of clickable options for the user using its actions property.

A simple MenuDialog listing actions like Play and Pause for media

Last updated