Skip to content

Pages

Page

Apps on Datapane can have multiple pages, which are presented to users as tabs at the top of your app. These can be used similarly to sheets in an Excel document.

To add a page, use the dp.Page block at the top-level of your app, and give it a title with the title parameter.

Info

Pages cannot be nested, and can only exist at the root level of your dp.App object. If you're using pages, all other blocks must be contained inside a Page block.

Note

This is included for backwards-compatability, and can be replaced by using Selects going forwards.

Parameters:

Name Type Description Default
*arg_blocks BlockOrPrimitive

Blocks to add to Page

()
blocks List[BlockOrPrimitive]

Allows providing the report blocks as a single list

None
title str

The page title (optional)

None
name BlockId

A unique id for the Page to aid querying (optional)

None

Tip

Page can be passed using either arg parameters or the blocks kwarg, e.g. dp.Page(group, select) or dp.Group(blocks=[group, select])

Simple Pages

import altair as alt
import seaborn as sns

titanic = sns.load_dataset("titanic")

points = (
    alt.Chart(titanic)
    .mark_point()
    .encode(
        x="age:Q",
        color="class:N",
        y="fare:Q",
    )
    .interactive()
    .properties(width="container")
)

dp.Blocks(
    dp.Page(title="Titanic Dataset", blocks=["### Dataset", titanic]),
    dp.Page(title="Titanic Plot", blocks=["### Plot", points]),
)