Layouts

This page explains the multiple layouts components and all the options to control the layout of the dashboard.

There is 3 main components of Jupyter-flex Dashboard: Cards, Sections and Pages and they have the following hirerchy: Pages > Sections > Cards. Meaning that Pages contain Sections and Sections contain Cards.

Cards

A Card is an object that holds any output components of the dashboard such as plots, text, widgets and more.

To define a new Card you use a level-3 markdown header (###). Each card belongs in a Section and one Section can have one or more Cards.

Any output components (plots or text) will be added to the current Card until a new Card, Section or Page is defined.

The components of a Card are:

  1. The header will be the value of level-3 markdown header (###)
  2. One (or more) code cells that contain plots tagged with chart, in general it's a good idea to just have one plot per card.
  3. One (or more) markdown cells tagged with text that contain some narrative for the dashboard
  4. Footer will be one markdown cell tagged with footer

For example this notebook with one Card, two plots and some text. Note that code cells get expanded to ocupy all the space in the Card while text cells get just use the space they need.

In [1]:
import plotly.express as px
In [2]:
df = px.data.iris()
In [3]:
### Card Header
In [4]:
text
####  This is some text
In [5]:
chart
# Another plot
fig = px.scatter(df, x="petal_width", y="petal_length")
fig.show()