Reflex Logo
Docs Logo
Library

/

Overlay

/

Dialog

The dialog.root contains all the parts of a dialog.

The dialog.trigger wraps the control that will open the dialog.

The dialog.content contains the content of the dialog.

The dialog.title is a title that is announced when the dialog is opened.

The dialog.description is a description that is announced when the dialog is opened.

The dialog.close wraps the control that will close the dialog.

The on_open_change event is called when the open state of the dialog changes. It is used in conjunction with the open prop, which is passed to the event handler.

Number of times dialog opened or closed: 0

Dialog open: false

Check out the menu docs for an example of opening a dialog from within a dropdown menu.

This example adds new users to a database from a dialog using a form.

  1. It defines a User model with name and email fields.
  2. The add_user_to_db method adds a new user to the database, checking for existing emails.
  3. On form submission, it calls the add_user_to_db method.
  4. The UI component has:
  • A button to open a dialog
  • A dialog containing a form to add a new user
  • Input fields for name and email
  • Submit and Cancel buttons

API Reference

rx.dialog.root

Root component for Dialog.

PropType | ValuesDefaultInteractive
open
bool
-
default_open
bool
-

Event Triggers

See the full list of default event triggers
TriggerDescription
on_open_changeFired when the open state changes.

rx.dialog.trigger

Trigger an action or event, to open a Dialog modal.

Props

No component specific props

rx.dialog.title

Title component to display inside a Dialog modal.

Props

No component specific props

rx.dialog.content

Content component to display inside a Dialog modal.

PropType | ValuesDefaultInteractive
access_key
str
-
auto_capitalize
"off" | "none" | ...
-
content_editable
Union["inherit" | "plaintext-only", bool]
-
context_menu
str
-
dir
str
-
draggable
bool
-
enter_key_hint
"enter" | "done" | ...
-
hidden
bool
-
input_mode
"none" | "text" | ...
-
item_prop
str
-
lang
str
-
role
"alert" | "alertdialog" | ...
-
slot
str
-
spell_check
bool
-
tab_index
int
-
title
str
-
size
"1" | "2" | ...
-

Event Triggers

See the full list of default event triggers
TriggerDescription
on_open_auto_focusFired when the dialog is opened.
on_close_auto_focusFired when the dialog is closed.
on_escape_key_downFired when the escape key is pressed.
on_pointer_down_outsideFired when the pointer is down outside the dialog.
on_interact_outsideFired when the pointer interacts outside the dialog.

rx.dialog.description

Description component to display inside a Dialog modal.

Props

No component specific props

rx.dialog.close

Close button component to close an open Dialog modal.

Props

No component specific props

Built with Reflex