panel.ui.layout.modal module#
A Material Dialog with the API of the classic Modal.
- class panel.ui.layout.modal.Modal(*objects, **params)[source]#
Bases:
DialogA modal dialog that can be opened and closed, implemented by the Material Dialog but keeping the classic Modal defaults and methods.
- Example:
>>> modal = Modal('Some content') >>> Column(modal.create_button('show', label='Open'), modal)
Methods
create_button(action, **kwargs)Create a button to show, hide or toggle the modal.
show()Starts a Bokeh server and displays the Viewable in a new tab.
hide
toggle
Parameter Definitions
Parameters inherited from:
panel.layout.base.ListLike: objectspanel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visiblepanel.custom.ReactComponent: use_shadow_dompanel_material_ui.base.MaterialComponent: loading, dark_theme, theme_config, sxpanel_material_ui.layout.base.MaterialLayout: marginpanel_material_ui.layout.base.Dialog: scroll, full_screen, open, title, title_variant, width_optionclose_on_click = Boolean(default=True, label='Close on click')Close when clicking outside the Dialog area.
show_close_button = Boolean(default=True, label='Show close button')Whether to show a close button in the modal.
background_close = Boolean(default=True, label='Background close')Whether to enable closing the modal when clicking the background. Alias of close_on_click.
- create_button(action: Literal['show', 'hide', 'toggle'], **kwargs) Button[source]#
Create a button to show, hide or toggle the modal.
- show()[source]#
Starts a Bokeh server and displays the Viewable in a new tab.
- Parameters:
- titlestr | None
A string title to give the Document (if served as an app)
- port: int (optional, default=0)
Allows specifying a specific port
- addressstr
The address the server should listen on for HTTP requests.
- websocket_origin: str or list(str) (optional)
A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, “localhost” is used.
- threaded: boolean (optional, default=False)
Whether to launch the Server on a separate thread, allowing interactive use.
- verbose: boolean (optional, default=True)
Whether to print the address and port
- openboolean (optional, default=True)
Whether to open the server in a new browser tab
- locationboolean or panel.io.location.Location
Whether to create a Location component to observe and set the URL location.
- Returns:
- server: bokeh.server.Server or panel.io.server.StoppableThread
Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)