Skip to content

dialog class

A modal dialog.

Methods

__init__()

__init__(
    open=False,
    on_action=None,
    close_label="Close",
    labels=None,
    width=None,
    height=None,
    page=None,
    partial=None,
    active=True,
    id=None,
    properties=None,
    class_name=None,
    hover_text=None,
) -> None

Create a new dialog element.

Parameters:

Name Type Description Default
open bool

If True, the dialog is visible. If False, it is hidden.

False
on_action Union[str, Callable]

A function or the name of a function triggered when a button is pressed.
This function is invoked with the following parameters:

  • state (State): the state instance.
  • id (str): the identifier of the dialog if it has one.
  • payload (dict): the details on this callback's invocation.
    This dictionary has the following keys:
    • action: the name of the action that triggered this callback.
    • args: a list where the first element contains the index of the selected label.

None
close_label str

The tooltip of the top-right close icon button. In the on_action callback, args will be set to -1.

Close
labels Union[str, list[str]]

A list of labels to show in a row of buttons at the bottom of the dialog. The index of the button in the list is reported as args in the on_action callback (that index is -1 for the close icon).

None
width Union[str, int, float]

The width of the dialog, in CSS units.

None
height Union[str, int, float]

The height of the dialog, in CSS units.

None
page str

The page name to show as the content of the block.
This should not be defined if partial is set.

None
partial Partial

A Partial object that holds the content of the block.
This should not be defined if page is set.

None
active dynamic(bool)

Indicates if this element is active.
If False, the element is disabled, and user interaction is not allowed.

True
id str

The identifier assigned to the rendered HTML component.
This can be used in callbacks or to target the element for styling.

None
properties dict[str, Any]

A dictionary of additional properties that can be set to the element.

None
class_name dynamic(str)

A space-separated list of CSS class names to be applied to the generated HTML element.
These classes are added to the default taipy-dialog class.

None
hover_text dynamic(str)

The text that is displayed when the user hovers over the element.

None