Page#

Download this notebook from GitHub (right-click to download).


import panel as pn
from panel_material_ui import Page, Tabs

pn.extension()

The Page component is the equivalent of a Template in Panel, defining the overall layout of an application.

Unlike a Template, the Page component is implemented entirely in JavaScript, allowing dynamic updates of its contents without re-rendering the entire layout.

Parameters:#

For details on other options for customizing the component see the layout and styling how-to guides.

Core#

  • config (Config): Configuration object declaring custom CSS and JS files to load specifically for this template.

  • logo (Path | str | dict[str, str | Path]): Logo to render in the header. Can be a string, a pathlib.Path, or a dictionary with breakpoints as keys, e.g. {‘sm’: ‘logo_mobile.png’, ‘md’: ‘logo.png’}.

  • meta (Meta): Meta tags and other HTML head elements.

  • title (str): Title of the application.

Layout#

  • header (Children): Items rendered in the header.

  • main (Children): Items rendered in the main area.

  • sidebar (Children): Items rendered in the sidebar.

  • contextbar (Children): Items rendered in the contextbar.

Contextbar#

  • contextbar_open (boolean): Whether the contextbar is open or closed.

  • contextbar_width (int): Width of the contextbar.

Busy Indicator#

  • busy (boolean, readonly): Linked to global busy state.

  • busy (Literal["circular", "linear"] | None): Whether to render a linear, circular or no busy indicator.


📄 Basic Example: Main, Sidebar, and Contextbar#

This example creates a simple Page layout with content defined in the main, sidebar, and contextbar areas.

page = Page(
    main=["## I'm the main area"],
    sidebar_width=250,
    sidebar=["## I'm the sidebar"],
    contextbar=["# I'm the contextbar"],
    title="I'm a title",
)

page.preview()

🔍 What’s Happening?#

  • main: The primary content area of the page, here showing a simple Markdown heading.

  • sidebar: A side panel typically used for navigation or filters. Its width is set to 250 pixels.

  • contextbar: An optional, secondary sidebar often used for auxiliary info or tools.

  • title: Sets the page title shown in the browser tab and can be used in the layout.