Serve a Project¶
The flowdash serve command scans a project directory, discovers components
and pages, and launches a Panel server with all routes configured.
Basic usage¶
This:
- Adds
my_project/tosys.path(unless it is served with--package) - Scans subdirectories for modules with
@register-decoratedappexports - Builds the component registry and specs
- Creates an
AssetStoreatmy_project/assets.db - Serves the app on
http://0.0.0.0:5006
The landing page lists the saved dashboards you can open as cards, each with a thumbnail of its tile layout, when it was last edited and by whom, and how it is shared. Filter them to the ones you own or that are shared with you, sort them by name or last edit, and switch between a grid and a list. Each card's menu opens, edits, renames, duplicates, shares, downloads or deletes the dashboard, offering only what your access allows. Below the dashboards are the project's pages and its most used components. From here you can also start a new dashboard or import a downloaded dashboard file.

CLI options¶
| Option | Default | Description |
|---|---|---|
--port |
5006 |
Port to serve on. |
--address |
0.0.0.0 |
Address to bind to. |
--title |
FlowDash |
Application title in the browser tab. |
--home-dashboard |
none | Dashboard (id or title) to show on the homepage instead of the grid. |
--nav-variant |
rail |
How navigation is rendered: rail, left, right or menubar. See Navigation. |
--package |
none | Serve the project as this importable package, naming modules <package>.<Section>.<name> instead of adding the directory to sys.path. See Serving a package. |
--project |
flowdash.yaml |
The project file whose sections configure the app. Without it FlowDash reads flowdash.yaml in the project directory. See Project File. |
--db-path |
<dir>/assets.db |
Path to the SQLite database. Conflicts with a store defined in the project. |
--warm |
off | Import all modules at startup instead of lazily on first visit. |
--dev |
off | Enable autoreload for development. |
--admin |
off | Enable the Panel admin interface. |
--admin-link |
off | Print a link that adds one admin even when the project already has admins. See The admin view. |
--profiler |
none | Profiler to use (pyinstrument, snakeviz). |
--num-threads |
auto | Thread pool size. |
--allow-websocket-origin |
all | Restrict allowed websocket origins. |
--no-notifications |
off | Disable Panel notifications. |
--static-dirs |
none | Serve extra static file directories, e.g. --static-dirs assets=/path/to/assets. Paths are resolved relative to the project directory. |
--agent-model |
none | A model the assistant may use, ID[=LABEL], e.g. --agent-model "openai:<model>=Fast". Repeat it, or separate models with commas, to offer several; the first is the default. Overrides agent_model, agent_models and an agent model string from __init__.py. See Let people pick the model. |
--component-library |
none | Offer the components of an installed library, e.g. --component-library my_library, or module:attribute for a mapping of component id to component. Repeatable, and added to component_libraries from __init__.py. See Components from an installed library. |
--plugins |
none | Register extra Tornado routes from an importable module exposing a ROUTES list, e.g. --plugins my_plugin for <project>/my_plugin.py. With --package, pass the dotted name, e.g. --plugins catalogue.my_plugin. Repeatable. |
--title, --home-dashboard and --nav-variant can also be set in the
project's __init__.py (see Project configuration).
A flag given on the command line takes precedence over the module attribute.
flowdash serve is built on Panel's serve command and inherits its full
set of CLI options (OAuth, REST providers, session options, and more).
Run flowdash serve --help for the complete, up-to-date list.
Development mode¶
With --dev, the server reloads automatically when source files change.
Custom database location¶
By default, the dashboard database is created inside the project directory. Override this for shared deployments:
Custom dashboard store¶
To keep dashboards somewhere other than SQLite, define store in the project's
__init__.py. It can be any BaseAssetStore, such as a folder of JSON
files that lives with the project:
# my_project/__init__.py
from pathlib import Path
from panel_flowdash import JSONFolderAssetStore
store = JSONFolderAssetStore(Path(__file__).parent / "dashboards")
See Persist dashboards for the available stores.
Passing --db-path as well is an error, since the two would disagree about
where dashboards live.
Homepage dashboard¶
By default the homepage (/) shows the launcher listing the saved dashboards
and the project's pages. To land users directly on a specific dashboard
instead, pass --home-dashboard with either its id or its title:
The dashboard is resolved by id first, then by title. Titles are only unique
per user, so a title prefers the current user's own dashboard, then the most
recently updated one they may open. Once dashboards with that title belong to
more than one user, the title is ambiguous: other users get the launcher grid
and an error is logged asking you to configure the dashboard by id, so that
nobody can replace the homepage by creating a dashboard with the same title.
Prefer an id whenever users can create dashboards. If it cannot be found, or
the current user is not authorized to view it, the homepage falls back to the
launcher grid. With a home dashboard, the launcher grid, Browse, with New
dashboard and Import, moves to /browse, which the Browse rail entry and the
breadcrumb open. /dashboards shows it too, so older links keep working.
Ask on the homepage¶
FlowDashApp(home="explore") (or home = "explore" in __init__.py) makes the
homepage a place to ask about the project's data. A switch at the top reads
Ask | Browse: Ask shows a composer holding the data as chips and the
Explore view's model picker, suggested questions as cards, the person's recent
chats and a "Your data" card, and Browse shows the launcher, which stays at /browse. The choice each person
made last is remembered in the project's usage ledger, so someone who mostly
browses lands on Browse. Without a project directory the choice is kept only
while the server runs. home="explore" turns on chats.
Asking makes a chat named after the question and continues on its Explore view
at /asset/<id>, where the question is asked. Three hooks fill the page; without
them it shows no chips, no suggestions and no "Your data" card:
# my_project/__init__.py
from panel_flowdash import DataAction, DataChip
home = "explore"
def data_chips(identity):
return [DataChip("duckdb:turbines", "turbines", group="Wind"),
{"id": "csv:prices", "label": "prices"}]
async def suggest_questions(chips):
return [
{"text": "Which manufacturers built the most turbines?", "columns": ["t_manu"]},
"How has capacity changed over time?",
]
def data_overview(identity):
return "**turbines**: 72,357 rows, 14 columns"
def open_upload(app):
... # e.g. open the host's own upload dialog
add_data = DataAction("Add a file", open_upload)
data_chips is called with the session's Identity and returns
DataChips or mappings with id, label, an optional group and an
optional detail shown after the label (e.g. "2 tables"); chips of a group are
shown together. suggest_questions is called with the chips picked (empty when
none is, which means all of the data) whenever they change, and returns a few
questions, or an awaitable of them. A question is a string, or a mapping (or a
Suggestion) with its text, the columns it uses, shown below it, and an
optional Material icon. An async hook is awaited on
the server's event loop and a plain function runs on a worker thread, so a slow
hook never holds up the page; the landing shows the questions of the newest
call and keeps the last ones if a call fails. A plain function may run while an
older call is still running and alongside the session's own work, so it must be
thread-safe (a shared database connection needs a cursor per call, for example);
make it async to run it on the event loop instead. If a plain function returns
an awaitable, it must be a coroutine rather than a future bound to a loop. add_data is an action shown
after the chips: a callable given the app, or a route or URL the host serves.
data_overview is called with the session's Identity and returns anything
Panel can show, or an awaitable of it, which fills the "Your data" card. Like
suggest_questions, an async hook is awaited on the event loop and a plain
function runs on a worker thread, so reading the sources' metadata never holds
up the page; the card appears once the hook answers, and is left out if it
fails or returns None. The card is left out at phone width.
Without a model there is nothing to ask with, so Home shows no composer, chips or suggestions and opens on Browse. The Ask tab stays only for someone with earlier chats, listing them to reread, and for admins, with a Set up a model button that opens Admin › AI. Anyone else sees no Ask tab, and Chats leaves the rail.
The chips picked when asking are stored on the chat (in its settings, under
data_scope) as the chat's scope. The default Explore agent is told the scope,
and tools read it as ctx.deps.scope. FlowDash does not keep the agent to it:
a host whose tools reach the data does that.
The chat page¶
A chat reads as one document: a column 820 pixels wide, centred, with the composer pinned at its foot. Above it, the chat's own bar has its title (the pencil renames it), how many answers it has and when it was last asked, Make a dashboard and a menu with Rename, what was made from the chat and Delete chat. A chat has none of a dashboard's chrome: no Dashboard | Report switch, Edit, Refresh or full screen. On a phone the bar is a back button, the title and the menu, which then also offers Make a dashboard.
Each question is a bubble with its time, and follow-ups stack below it as turns, with a divider between them. A new question moves to the top of the view and its answer fills in below it. At desktop width, In this chat lists the answers to the right of the column, marks the one in view, and scrolls to the one clicked.
Under each question, "What I did" says in one sentence what the agent did, from its tool calls ("Looked at turbines · drew a chart · 2.1 s"). Opened, it lists one row per step in plain words, with what the step touched and its time, and the model and the number of model calls at its foot, with Show model calls (tokens and cost per call) and Open the trace. Tokens and cost are not shown under answers otherwise. While an answer is made, the steps show live with the time so far, a dashed placeholder marks where the answer will land, and the send button is a Stop button; a question typed meanwhile waits and is asked once the answer is done. "What I did" opens itself when a step failed and says, in the error colour, whether it was fixed. A run that stopped with an error says whether anything in the chat changed and offers Retry, Retry with another model and Show details.
The composer has the chat's scope as a chip, with the data_chips hook's
chips to add and the ones in the scope to take out. Hosts describe their own
tools' steps with panel_flowdash.agent.register_step_text, and show a
notice under an answer with register_chat_notice, for example that the
data asked about is outside the chat's scope, with Add … to this chat
(add_to_scope, which also points out the scope chip) and Ask in a new
chat (new_chat). Other notice actions go to a handler registered with
register_notice_action. The steps of an earlier session's answers are not
stored, so a reopened chat shows its questions and answers without them.
From a chat to dashboards and reports¶
A chat's answers are not on any dashboard or report until someone adds them.
On a chat's answer, Add to… asks where to, in three groups: New
(a new dashboard or a new report, titled from the question), the person's
most recently changed dashboards they may edit, and their recent reports
they may edit. The chat remembers the last pick (in its settings, under
add_target) and offers it first next time. The answer is copied the same
way Add to dashboard copies it inside a dashboard's own Explore view, with
the nodes it is built from, reusing those the target already has, and the
target is saved at once. On a dashboard the answer gets a tile; on a report
it gets a block at the end of the report document. The card then offers
Open dashboard or Open report.
Make a dashboard, at the top of a chat, picks some of its
answers (those already added somewhere, else all) and makes one new
dashboard or report from them, titled from the chat. A dashboard is laid out
like the assistant lays out a dashboard; a report shows a block per answer,
in the order picked. The chat stays as it was and links to what was made
from it (kept under made_dashboards). Nothing in a chat becomes visible to
anyone else except by being copied onto a dashboard or report they can open.
A chat stores its answers on itself, as the nodes of its own graph (never laid out as tiles) with the turns that made them, as each request ends. Opening the chat again rebuilds them, so their queries run again and show current data, and their cards can be added to dashboards as before. An answer whose component is gone or fails to load says so on its card.
Running as a module¶
You can also run FlowDash without the entry point script:
Lazy loading and warm start¶
By default, page and component modules are imported lazily — on the first visit to that page or on first open of the component editor. This keeps startup fast even when individual modules have heavy dependencies.
Pass --warm to import all modules at startup instead:
Import errors are logged as warnings; they do not abort startup.
Project initialization file¶
If my_project/__init__.py exists, it is executed during server startup,
before Panel launches. Use it for any
pre-configuration that the rest of the project depends on:
# my_project/__init__.py
import os
import panel as pn
os.environ.setdefault("DATABASE_URL", "postgresql://localhost/mydb")
# Register Panel extensions needed by your components (e.g. tabulator, vega, deckgl).
# FlowDash only calls pn.extension() with notifications enabled by default,
# so any additional extensions must be loaded here.
pn.extension("tabulator", "vega", sizing_mode="stretch_width")
The file runs with my_project/ already on sys.path and as the working
directory, so local relative imports work normally. A project served with
--package is imported as that package instead, see below.
Project configuration¶
After executing __init__.py, flowdash serve reads the following module
attributes and passes them to FlowDashApp. All are optional, and a name that is
missing or set to None keeps its default.
| Name | Type | Description |
|---|---|---|
store |
BaseAssetStore |
Where dashboards are kept, see Custom dashboard store. Conflicts with --db-path. |
add_data |
DataAction |
The Ask homepage's "add data" action, see Ask on the homepage. |
breakpoints |
list |
Responsive breakpoints of the tile grid. Default [768, 1200]. |
chats |
bool |
List each person's chats in the rail and at /chats, see Sidebar sections. |
component_libraries |
list |
Installed libraries whose components the editor offers, see Components from an installed library. --component-library adds to it. |
configure_layout |
callable | Per-page sidebar and contextbar hook, see Page-aware sidebar and contextbar. |
controls_position |
str |
Where sidebar=True components go: "top" (default) in a row above the tiles or "left" in a collapsible panel, see Layout & sizing. Dashboards can override it in their settings. |
data_chips |
callable | The data the Ask homepage offers as chips, see Ask on the homepage. |
editor_class |
FlowDash subclass |
The editor class the app instantiates. |
editor_options |
dict |
Extra keyword arguments for the editor, see Embed the Editor. |
header_layout |
str |
"compact" (default) puts a dashboard's title, health and actions in the top bar, "full" in a row of their own under it, see Navigation. Dashboards can override it in their settings. |
home |
str |
"launcher" (default) or "explore", see Ask on the homepage. |
home_dashboard |
str |
Dashboard id or title shown on the homepage. Overridden by --home-dashboard. |
include_builtin_components |
bool |
Offer the built-in widget components in the editor. Default True. |
admin_link |
bool |
Whether the admin link printed at startup can claim the admin view. Default True, see The admin view. |
trusted_proxies |
list |
IP addresses of reverse proxies whose X-Forwarded-For names the client, for the localhost rule of admin without sign-in. Default none. |
nav_variant |
str |
"rail" (default), "left", "right" or "menubar", see Navigation. Overridden by --nav-variant. |
notifications |
bool |
Show user-facing messages as Panel notifications. Default True. |
page_options |
dict |
Extra keyword arguments for the underlying panel_material_ui.Page. |
propagate_failures |
bool |
Carry failures downstream, see Wire Dataflow. |
sections |
list[SidebarSection] |
Extra navigation sections shown in the rail and narrow-screen drawer (nav_variant="rail" only), see Sidebar sections. |
settings_class |
DashboardSettings subclass |
Dashboard-wide settings, see Dashboard Settings. |
suggest_questions |
callable | Questions the Ask homepage suggests, see Ask on the homepage. |
title |
str |
Application title in the browser tab. Overridden by --title. |
The authorization names group_claims, user_groups, resolve_groups,
admin_groups and default_allow are read too, see
Manage Permissions.
# my_project/__init__.py
import param
from panel_flowdash import DashboardSettings, JSONFolderAssetStore
class SalesSettings(DashboardSettings):
currency = param.Selector(default="EUR", objects=["EUR", "USD", "GBP"])
store = JSONFolderAssetStore("dashboards")
settings_class = SalesSettings
propagate_failures = True
editor_options = {"popup_trigger": "hover"}
title = "Sales"
Each value is checked against the matching FlowDashApp parameter at startup,
and a value of the wrong type stops the server with an error naming the
attribute. editor_options and page_options are shared by every session, so
create any Panel objects they would hold in an editor_class subclass or in
configure_layout instead. sidebar and contextbar are not read for the same
reason; set them from configure_layout.
The admin view¶
Admins get an Admin item at the bottom of the rail, which edits the
project file's settings (see the
Project File reference).
An admin is a member of admin_groups or a user named in the project
file's general.admins, which admins can edit under Admin, General.
Without sign-in, admin rights apply only in a browser on the machine that
runs the server (see Two ways of working).
Claiming a new project¶
While a project has no admin (no admin_groups and nobody in general.admins),
flowdash serve prints a link when it starts,
as Jupyter does:
No one administers this FlowDash project yet. Open this link to become its admin
(valid until the server restarts):
http://localhost:5006/admin#token=Xb3...
The token is random, kept in memory and new on every start. It travels in
the URL fragment, which the browser never sends to the server, so it
appears in no access log, and the page removes it from the address bar
once it has handed it over. Whoever opens the link is added to
general.admins (as local:<account> without sign-in, auth:<user>
with it) and is admin on every later start, with no token. Without
sign-in the link works only in a browser on the server's machine.
The link claims the project once: the token stops working after its first
use, and it is refused once the project has an admin or admin_groups,
even if the printed link is still in a console or log. To add an admin
when the existing ones are away, restart with --admin-link, which prints
a link that adds one more admin, again once. FLOWDASH_ADMIN_TOKEN fixes
the token for scripted setups; it too works once per start and only under
the same rules. Unlike the random token it is the same after a restart, so
it claims the project again on every start until someone is recorded, and
adds an admin on every start with --admin-link: unset it once setup is
done. Set admin_link = False in __init__.py to turn the link off
entirely.
The setup wizard¶
When the admin link claims a project whose file has no settings yet, the
first admin lands in the setup wizard at /admin/setup, and so does an
admin by admin_groups or general.admins the first time they open such a
project at its home page; a link to any other page still opens that page.
It walks through
Welcome, Data (the served data folder, or the data sources an extension
such as Lumen adds), AI (a provider, its key and a model), Theme (colour,
title, logo and favicon), People (admins, admin_groups and default_allow) and
Review. Review shows what will be written to flowdash.yaml, line by line,
and nothing is written until you click Finish there; Cancel or Skip setup
leaves the file as it was. Each step can be skipped, and the wizard can be
opened again at any time from Admin, General.
The AI step writes the provider key as a reference to an environment
variable, such as ${OPENAI_API_KEY}, unless you choose to paste a key,
which is then stored encrypted like one saved under Admin, AI. Once the key
can be read, the Model field suggests the chat models the provider lists for
it, newest first; you can still type any model id. Adding a model under
Admin, AI suggests the models of every provider with a key in the same way.
Two ways of working¶
Shared project, launched by each person. The project folder lives in
version control or on a network drive and each person runs
flowdash serve on their own machine, without sign-in. Without sign-in
every visitor of a server is the account that runs it (its OS user name),
so general.admins names OS accounts, such as local:philipp.
Admin rights then apply only to a browser on the machine that runs the
server: a request whose client is a loopback address (127.0.0.1 or
::1). A visitor from another machine never gets Admin, and the admin
link refuses them. Loopback includes everyone who reaches the port from
that machine: other OS users on it, and anyone with an ssh -L tunnel or
another port forward to it.
The client is the socket's peer, and headers are read from the request
the server received, never from the session token. A request that came
through a reverse proxy, i.e. carries Forwarded, Via, X-Real-Ip,
Cf-Connecting-Ip, True-Client-Ip or any X-Forwarded-* header, is
never local unless the proxy's address is listed in trusted_proxies.
Then the last address in X-Forwarded-For that is not a trusted proxy is
checked instead, so the proxy must set or append that header (nginx:
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;). A proxy
that only sets X-Real-Ip lets a client send its own
X-Forwarded-For: 127.0.0.1. With 127.0.0.1 in trusted_proxies, a
browser that connects to the server directly on that machine, without the
proxy, is refused too, since it sends no X-Forwarded-For.
Everything else is not a security boundary. Without sign-in, every visitor
from another machine is the server's account too: they own the dashboards
it made, match the rules that name it, and can use the assistant with the
project's model keys. Serve with sign-in for anything reachable from
other machines. Anyone who can edit the project file can also make
themselves admin. Never pass --allow-websocket-origin=*, which lets any
web page a local user opens, directly or through DNS rebinding, connect to
the server as that local browser, and set BOKEH_SIGN_SESSIONS=yes with a
BOKEH_SECRET_KEY so clients cannot make up their own session tokens.
Deployed with sign-in. Configure OAuth (Panel's --oauth-provider
options) and, if you like, admin_groups. The user who opens the admin
link is recorded by their sign-in name, as auth:<name>, and only they,
the other auth: users in general.admins and the members of
admin_groups get the admin view; local: entries and unprefixed names
from working without sign-in never match a signed-in user. Panel's --basic-auth with one
shared password does not count as sign-in here, since it accepts any user
name: admin rights then need a browser on the server's machine, as without
sign-in. Basic auth with a JSON file of users and passwords does count. The
link works from wherever it is opened, so it is also safe behind a proxy;
treat it like a password until it has been used.
Serving a package¶
By default FlowDash imports my_project/Analytics/chart.py as the module
Analytics.chart, which only resolves because the project directory is put on
sys.path. If the catalogue is also an importable package, installed or with
its parent directory already on the path, its own code and tests import the same
file as catalogue.Analytics.chart. Python then holds two separate module
objects for one file, each with its own classes and module state.
Pass the package name with --package to make FlowDash use the package's names:
pip install -e . # or put the directory containing catalogue/ on PYTHONPATH
flowdash serve path/to/catalogue/ --package catalogue
FlowDash then:
- names every module
catalogue.<Section>.<name>, both when importing it lazily and on the served component's__module__ - does not add
path/to/catalogue/tosys.path - imports the project's
__init__.pyascatalogueitself, sostore,settings_class,editor_classand the rest of the project configuration come from the same module the rest of your code imports
The package must resolve to the directory being served. If catalogue is not
importable, or imports from somewhere else (a stale install, say), flowdash
serve exits with an error naming both locations before starting the server.
Each section directory needs an __init__.py unless you rely on namespace
packages.
Plugins that live in the package are passed by their dotted name too:
A bare --plugins my_plugin still imports, because Panel looks for plugins in
the working directory and flowdash serve changes into the project directory,
but it becomes a separate top-level my_plugin module rather than the
catalogue.my_plugin the rest of your code imports.
Programmatically, pass the same option to FlowDashApp(project_dir=...,
package="catalogue") or to panel_flowdash.registry.build_registry(project_dir,
package="catalogue").
Navigation¶
By default (nav_variant="rail") the app shows a navigation rail on the left
with Home, Browse (the launcher), Components, Pages (a menu of the code
pages the user may open) and Help, the item for the current route
highlighted. The top bar shows where you are as a breadcrumb, for example
Browse › Sales, where the dashboard title opens a switcher listing every
dashboard the user can see, or Home › Components on other routes. On screens
narrower than 600 px the rail moves into the page's side drawer, which the
menu button in the top bar opens, above any sidebar content of the page.
With the default header_layout="compact" the top bar is the dashboard's
header too, so there is a single row above the tiles. Next to the title it shows an info button holding the
dashboard's description and a health chip ("9/9 up to date", or the number of
failed and waiting tiles), which opens the pipeline and a Show issues action.
On the right it has the Dashboard/Report switch, Ask, Edit, Refresh with the
auto-refresh period (its tooltip says when the dashboard was last refreshed),
Full screen and a menu of further actions. In edit mode the same row holds
the save state, the Dashboard/Report switch, the Dataflow/Layout/Split tabs, Ask,
Settings, Share (for admins), Discard, Save and Done. The search field
shrinks to an icon button on a dashboard unless the window is very wide.
header_layout="full" gives the dashboard a row of its own under the top bar
instead, with the same actions on the right and, on the left, a large title over
the description, the health chip and when the dashboard was last refreshed. The
search field then keeps its full width. It takes about 80 px more above the
tiles, so it suits dashboards whose description should always be in view. Set
it for the whole app (also from a project's __init__.py), or per dashboard
with the Header choice in the dashboard's settings.
The search field in the top bar, or Ctrl+K (⌘+K on macOS) anywhere in the app, opens a command palette. Typing filters dashboards the user can open, components (added to the dashboard in edit mode, otherwise opening the component library), Inspect and Expand for the current dashboard's tiles where the tiles offer them, and actions such as Refresh, Edit dashboard, Save, Dashboard settings and switching the theme. The arrow keys move through the results and Enter runs one. Outside text fields these shortcuts also work:
| Key | Action |
|---|---|
| R | Refresh the dashboard |
| E | Edit the dashboard, for users who may edit it |
| F | Show the dashboard in full screen, or leave it |
| Esc | While editing, close what is open first: a menu or dialog, the focus on the code panel's buttons, then the selection (on the canvas or the layout grid); with nothing open, back to view mode (asks first when there are unsaved changes) |
| Ctrl/⌘+S | Save, in edit mode |
| S | Show the Dataflow canvas and the Layout grid side by side, or back to one tab, in edit mode |
| / | Search the component palette beside the canvas, opening it first if it is folded, in edit mode |
| ? | List the keyboard shortcuts |
Full screen¶
To present a dashboard, or show it on a wall display, open it in full screen with the full screen button next to Refresh, Full screen in the command palette, or F. The tiles and the controls bar then fill the screen, reflowed to its size, without the top bar, the navigation rail or the dashboard bar. Moving the pointer, a tap or a key press shows a small overlay in the bottom-right corner with the dashboard's health and an exit button; it hides again, with the pointer, after a few seconds. The overlay shows no title, but screen readers announce it with the dashboard's title. Menus, dialogs such as Expand and Inspect, the command palette and notifications show in full screen, in the current light or dark theme, and auto-refresh keeps running. Tab moves through the dashboard only, never into the page behind it. Leave with Esc, the browser's own control, the exit button or F.
Full screen is part of view mode: it is not offered while editing, and switching to edit mode or to another page leaves it.
Browsers only grant full screen in response to a click or key press, so a link
cannot open it. Add ?kiosk=1 to a dashboard's URL, for example
/asset/<id>?kiosk=1, to open it in the same layout covering the browser
window, which is what a wall display running the browser in its own kiosk
mode needs. F then switches to real full screen, and
Esc or the exit button returns to the normal page.
The other variants keep the earlier navigation: left and right dock a
navigation tree in a drawer on that side of the page, and menubar puts
Navigate and Dashboards menus in the page header. With these the dashboard's
title, health chip and actions sit in a row of their own above the tiles.
Whichever variant you use, anything that would throw away unsaved edits asks first, listing what changed: opening another page or dashboard, choosing the dashboard you are editing to return to view mode, or creating a new dashboard. Reloading or closing the browser tab with unsaved changes makes the browser ask before leaving.
The sidebar's menu button only appears when the sidebar has content, such as
items set through configure_layout. Components registered with sidebar=True
are shown with the dashboard's tiles (above them or in a panel to their left,
see controls_position), or in the sidebar when
editor_options={"controls_bar": False}.
Sidebar sections¶
When nav_variant="rail" (the default), the navigation rail and narrow-screen
drawer render registered SidebarSection entries in ascending order,
starting with the built-in Dashboards section (id="dashboards", order=0).
Sidebar sections do not appear in the legacy left, right, or menubar
variants. Pass additional sections via FlowDashApp(sections=[...]), define
sections = [...] in the project's __init__.py, or call app.add_section(...)
at runtime.
Every callback (items, visible, path, new_action.action, and view)
receives a SidebarContext with ctx.app, ctx.user, ctx.section,
ctx.is_admin, ctx.still_admin(), ctx.navigate(url), and ctx.refresh().
ctx.is_admin (like app.is_admin) is cached per session for showing or hiding
UI; call ctx.still_admin() before performing a privileged write or admin
action so revoked permissions take effect immediately. Give a section its
own URL prefix with route and view so FlowDash serves /<route> and
/<route>/... directly without registering pages under Pages:
import panel as pn
from panel_flowdash import SidebarAction, SidebarItem, SidebarSection
REPORTS = {"q4": "Q4 Revenue Summary"}
def list_reports(ctx):
return [
SidebarItem(title=title, url=f"/reports/{slug}", subtitle=ctx.user.user)
for slug, title in REPORTS.items()
]
def report_view(ctx, path):
if not path:
return pn.pane.Markdown("## All reports")
return pn.pane.Markdown(f"## {REPORTS.get(path, path)}")
def create_report(ctx):
slug = f"r{len(REPORTS) + 1}"
REPORTS[slug] = f"Report {slug.upper()}"
ctx.refresh()
ctx.navigate(f"/reports/{slug}")
reports = SidebarSection(
id="reports",
label="Reports",
icon="assessment",
order=10,
route="reports",
view=report_view,
items=list_reports,
new_action=SidebarAction(label="New report", action=create_report),
visible=lambda ctx: ctx.is_admin or "analysts" in ctx.user.groups,
)
A section with route and view and no items or new_action (such as a
Data catalog) links directly to /<route> in the rail and drawer. Each item's
url (and ctx.navigate(url)) opens through the app's router, or in a new tab
if it starts with http:// or https://. Item subtitles (SidebarItem.subtitle)
are shown as secondary text in the narrow-screen drawer; desktop rail menus show
titles only because pmui.MenuButton does not render secondary lines.
Pass routed sections to FlowDashApp.build_routes(sections=...) (as a list or
zero-argument callable) or define sections in the project's __init__.py so
direct loads and browser reloads resolve; a routed section added later with
app.add_section() works for in-session navigation only and returns 404 on
reload. Avoid subpaths whose final segment is ws, metadata, autoload.js
or static (or that contain a static/ segment), as Bokeh/Panel reserves
those endpoints and cannot reload them directly.
FlowDashApp(chats=True) adds a built-in Chats section (id="chats") after
Home and before Browse. It lists the signed-in person's chats, newest first
with when each last changed, and links to /chats, which lists them with
Rename and Delete. A chat opens at /asset/<id> on the Explore view. Chats are
private to their owner and never shared, see
Chats. The section is off by default, so plain
FlowDash shows no Chats entry.
A built-in Reports section (id="reports") follows Browse whenever Browse is
in the rail. It lists the reports the person
may open, by title, offers New report, and /reports shows Browse with only
reports listed. A report opens at /asset/<id> on the report editor.
Browse lists every asset the person may open, dashboards, reports and (with chats on) their chats, with a kind filter showing how many there are of each, an owner filter (Anyone, Me, Shared with me), a search, the sort, grid or list and New: a blank dashboard, a blank report, a dashboard from a template, or an imported file. An empty project shows its first steps and the templates.
Section items are cached per refresh so navigation does not re-query on every
route change. Call app.refresh_sections(section_id=None) (or ctx.refresh())
after mutating items; items also re-fetch automatically when a section's rail
menu or the narrow-screen drawer opens so changes made by other users appear.
Page-aware sidebar and contextbar¶
FlowDashApp exposes two sidebar and contextbar parameters whose contents
are prepended to the app's own sidebar and navigation contextbar. To populate
them differently depending on which page is being served, define a
configure_layout function in the project __init__.py:
# my_project/__init__.py
import panel_material_ui as pmui
def configure_layout(app, content, route):
"""Set sidebar/contextbar contents for the page currently being served.
Called on every navigation with:
app - the FlowDashApp instance (set app.sidebar / app.contextbar)
content - the resolved view for this route (page, editor, gallery or launcher)
route - the current pathname, e.g. "/", "/components", "/asset/<id>"
"""
if route.startswith("/asset/"):
app.sidebar = [pmui.Typography("Dashboard tools", variant="overline")]
app.contextbar = []
else:
app.sidebar = []
app.contextbar = []
FlowDash looks the function up by name after executing __init__.py, so the
name must be exactly configure_layout. It runs once per navigation, just
before the main area is rendered, and is responsible for both slots: whatever
you assign to app.sidebar / app.contextbar replaces the previous page's
contribution, so clear a slot by assigning []. Exceptions raised by the hook
are logged and do not break navigation.
When the app has a contextbar, the top bar gets a button to open and close it.
It starts closed (contextbar_open=False), so an assistant or other side panel
in the contextbar is there when the user wants it rather than taking space on
every page. Set app.contextbar_open in the hook only to open it deliberately.
The route argument distinguishes the built-in routes (/ for the launcher,
/components for the component gallery, /asset/<id> for a saved dashboard) from page
routes (/<Section>/<name>). Use content when the sidebar needs to reach into
the rendered view itself.
Project structure requirements¶
my_project/
__init__.py # optional startup hook and project configuration
SectionA/
__init__.py # optional
component1.py # must export `app`
component2.py
SectionB/
page1.py
.hidden/ # ignored (starts with .)
_private/ # ignored (starts with _)
Each Python file must export an app attribute decorated with @register.
Files starting with _ are skipped. Directories starting with . or _ are
skipped.