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 this dialog, in CSS units.

None

height

Union[str, int, float]

The height of this 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

bool
dynamic

Indicates if this component is active.
An inactive component allows no user interaction.

True

id

str

The identifier that is assigned to the rendered HTML component.

None

properties

dict[str, Any]

Bound to a dictionary that contains additional properties for this element.

None

class_name

str
dynamic

The list of CSS class names that are associated with the generated HTML Element.
These class names are added to the default taipy-dialog class name.

None

hover_text

str
dynamic

The information that is displayed when the user hovers over this element.

None