Adding blocks to your app
In the previous section, we saw that apps are comprised of multiple Blocks, which wrap up Python objects, such as Pandas DataFrames, Visualizations, and Markdown. Datapane also includes layout blocks to add tabs, pages, and interactive selects to your apps.
Request
We are always adding new blocks, and if you have some ideas on what you would like to use in your apps, please suggest one on our Feedback Portal
Datapane supports the following Blocks. More in-depth documentation is provided in our blocks catalog.
Block types
-
dp.BigNumber
dp.DataTable
dp.Table
-
dp.Plot
-
dp.Code
dp.Formula
dp.HTML
dp.Text
-
dp.Divider
dp.Group
dp.Page
dp.Select
dp.SelectType
dp.Toggle
-
dp.Media
dp.Attachment
dp.Embed
Nesting of Blocks
Except for Page blocks, every block can be nested inside a layout block, meaning you can build arbitrarily complex apps. In addition, most blocks take optional name
and caption
parameters and display those to your viewers.
Default Block Handling
As well as explicitly specifying your block type (for instance, by using dp.Plot
), Datapane will try and choose the best block for your object if you pass it in directly, for instance as follows:
The defaults are as follows:
Object Type | Datapane Block |
---|---|
pandas DataFrame | dp.Table (up to 100 cells),dp.DataTable (over 100 cells) |
string | dp.Text |
Altair | dp.Plot |
Bokeh | dp.Plot |
Folium | dp.Plot |
Matplotlib / Seaborn | dp.Plot |
Plotapi | dp.Plot |
Plotly | dp.Plot |