Utilize Templates
Welcome to the world of Panel templates! In this tutorial, we'll explore how to harness pre-made templates to effortlessly structure your app with a header, sidebar, and main area.
Templates offer a streamlined approach to app layout and design, providing:
Ready-made templates accessible in the
pn.templatenamespace.A variety of customizable options to suit your specific needs.
Crafting a Hello World App
Let's start by creating a basic app using the FastListTemplate. Copy the following code into a file named app.py:
Serve the app with:
It should resemble the following:

:::{note} In the code snippet:
pn.template.FastListTemplatedefines the template to use.titlesets an optional title for the top header.sidebarandmaindesignate content areas for the sidebar and main section, respectively.
For additional configuration options, refer to the FastListTemplate reference guide. :::
:::{tip} Panel offers a rich assortment of built-in templates, including a versatile Slides template. :::
Take a moment to explore the Templates Section in the Component Gallery, then return here.
Integrating Templates in a Notebook
While templates shine in serving apps, they're currently not displayable within notebooks. Copy the following two code cells into a notebook:
Append a ; after .servable() to prevent template display in the notebook. Preview the app; it should resemble:

:::{warning} Notebook display of templates is not currently supported. Show your support for this feature by upvoting Issue #2677. :::
Tailoring the Template
Let's customize the template further. Copy the code below into app.py:
Serve the app with:
It should appear as shown below. Try toggling the theme button in the upper right corner.

Upon toggling, the app should switch to dark mode:

:::{note} In the code:
pn.config.themedetermines the selected theme ("default" or "dark").alt.theme.enable("dark")applies the "dark" theme to the plot. Panel doesn't do this automatically.accentsets the primary or accent color for the template, allowing quick branding of the app.main_layoutspecifies a layout to wrap each object in the main list. Choose from"card"(default) orNone.
Note that accent and main_layout are exclusive to Fast templates like FastListTemplate and FastGridTemplate. :::
Recap
In this tutorial, we've explored the power of pre-made templates for structuring your app with ease:
Templates are available in the
pn.templatenamespace.Find a variety of templates in the Templates Section of the Component Gallery.
Templates offer high customizability.
References
How-to Guides
Explanations
Component Gallery
Explore the Templates Section in the Component Gallery for more options.