Build HTML layouts in Dash with HTML
Project description
Build your Dash layouts with HTML snippets
This package allows you to craft your Dash application layouts by writing HTML instead of a cascade of Python objects.
Installation
You can install the package with pip:
pip install dash-htmlayout
Introduction
It's a bit counterproductive to force users to build dashboard layouts using Python, when most component classes are translated into HTML.
Having to write code such as the following:
app.layout = html.Section()
app.layout.children = [
html.H1("Dashboard component.", className="mb-5"),
html.Div(
className="row",
children=[
html.Div(
className="col-3",
children=[
html.Div(
className="form-group mb-3",
children=[
html.Label("Genres filter"),
dcc.Dropdown(
id="genre-list",
placeholder="Filter genres",
multi=True,
),
],
),
html.Div(
className="form-group mb-3",
children=[
html.Label("Max results"),
dcc.Slider(
id="genre-limit", min=5, max=15, step=1, value=10
),
],
),
],
),
html.Div(
className="col-5 d-flex align-items-stretch",
children=[
html.Div(className="card flex-fill", children=[
html.H2("Genre information", className="text-center card-header"),
html.Div(className="card-body", children=[
dcc.Graph(id="genre-info"),
]),
]),
],
),
html.Div(
className="col-4 d-flex align-items-stretch flex-fill",
children=[
html.Div(className="card flex-fill", children=[
html.H2("Artists", className="text-center card-header"),
dcc.Markdown(id="artist-info", className="card-body"),
]),
],
),
],
),
]
should almost be considered malpractice in Python when there is a language and a document type that addresses this exact need; HTML.
Instead, this package provides a simple class to generate layouts from a partial HTML document. For example, we could partially reproduce the above example with such a file:
<section>
<h1 class="mb-5">Dashboard component.</h1>
<div class="row">
<div class="col-3">
<div class="form-group mb-3">
<label for="">Genres filter</label>
<dcc.dropdown id="genre-list" placeholder="Filter genres" multi/>
</div>
<div class="form-group mb-3">
<label for="">Max results</label>
<dcc.slider id="genre-limit" min=5 max=15 step=1 value=10/>
</div>
</div>
...
</div>
</section>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dash_htmlayout-0.9.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d528bdaff88a0198fc4545d59369393d4de99f39c0c11003a30d37a8e2b1ba5f |
|
MD5 | 336c9f28598e76dae472e8a6c578b313 |
|
BLAKE2b-256 | 4cd179426ff76c8d1d6779adf5bc5590242c416d00b6881c142ccd64d8d18780 |