Skip to main content

Vizro Dash Components are used by the Vizro framework but can be used in a pure Dash app

Project description

Vizro Dash Components

Vizro Dash Components are used by the Vizro framework but can be used in a pure Dash app. Use as import vizro_dash_components as vdc.

See the example Dash app and its live demo on PyCafe for a full demo of all components.

Installation

pip install vizro-dash-components

Components

Markdown

Based on dcc.Markdown, with identical properties. Renders Markdown content with syntax-highlighted code blocks via dmc.CodeHighlight and dmc.InlineCodeHighlight. Requires a dmc.MantineProvider wrapper.

import dash_mantine_components as dmc
import vizro_dash_components as vdc
from dash import Dash

app = Dash(__name__)

app.layout = dmc.MantineProvider(
    vdc.Markdown(
        id="my-markdown",
        children="""
            # Hello World

            ```python
            print("Hello, World!")
            ```
            """,
    )
)

if __name__ == "__main__":
    app.run()

Cascader

Hierarchical cascading dropdown inspired by Ant Design Cascader and fac.AntdCascader. Users navigate a tree of options via side-by-side panels and select leaf values. Supports single-select and multi-select. It accepts all the same arguments as dcc.Dropdown (for example className, style, clearable, searchable, search_value, placeholder, disabled, multi, optionHeight, maxHeight, debounce, closeOnSelect, labels, and persistence props) and is built to visually match it. Use help(vdc.Cascader) for the full list.

options format

options for dcc.Dropdown describes a flat list and can be given in two different formats: a shorthand and an explicit option dict. options for vdc.Cascader describes a tree and can similarly be given in two different formats:

  1. Shorthand

    • dcc.Dropdown: a list, for example ["New York City", "Montreal"].
    • vdc.Cascader: a nested dict/list, for example {"USA": ["New York City", "Boston"], "Canada": ["Toronto", "Montreal"]}.
  2. Explicit option dicts

    • dcc.Dropdown: a list of dicts, each with label and value, plus optional keys such as disabled and search.
    • vdc.Cascader: a list of dicts, each with label and value, plus optional keys such as disabled and search. Parents also have children, a list of child dicts; leaves omit children.

Only leaf values appear in the vdc.Cascader component’s value (single value or list when multi=True).

from dash import Dash, Input, Output, html
import vizro_dash_components as vdc

OPTIONS = {
    "Asia": {
        "Japan": ["Tokyo", "Osaka", "Kyoto"],
        "China": ["Beijing", "Shanghai", "Guangzhou"],
    },
    "Europe": {
        "France": ["Paris", "Lyon", "Marseille"],
        "Germany": ["Berlin", "Munich", "Hamburg"],
    },
}

# Same tree in explicit form.
# label doesn't need to match value any more.
# Optional on any dict: disabled, search.
# OPTIONS = [
#     {
#         "label": "Asia",
#         "value": "Asia",
#         "children": [
#             {
#                 "label": "Japan",
#                 "value": "Japan",
#                 "children": [
#                     {"label": "Tokyo", "value": "Tokyo"},
#                     {"label": "Osaka", "value": "Osaka"},
#                     {"label": "Kyoto", "value": "Kyoto"},
#                 ],
#             },
#             {
#                 "label": "China",
#                 "value": "China",
#                 "children": [
#                     {"label": "Beijing", "value": "Beijing"},
#                     {"label": "Shanghai", "value": "Shanghai"},
#                     {"label": "Guangzhou", "value": "Guangzhou"},
#                 ],
#             },
#         ],
#     },
#     ... similarly for Europe
# ]

app = Dash(__name__)
app.layout = [
    vdc.Cascader(id="regions", options=OPTIONS, placeholder="Select a city..."),
    html.Div(id="out"),
]


@app.callback(Output("out", "children"), Input("regions", "value"))
def show(value):
    return f"Selected leaf value: {value!r}"


if __name__ == "__main__":
    app.run()

Development

Contributor workflows (Hatch, npm, regenerating vizro_dash_components/) are documented in AGENTS.md (same content as CLAUDE.md for Claude Code).

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

vizro_dash_components-0.1.1.tar.gz (869.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vizro_dash_components-0.1.1-py3-none-any.whl (827.0 kB view details)

Uploaded Python 3

File details

Details for the file vizro_dash_components-0.1.1.tar.gz.

File metadata

  • Download URL: vizro_dash_components-0.1.1.tar.gz
  • Upload date:
  • Size: 869.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vizro_dash_components-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1825ea1dc28d41424f5f4eae8558f9534a4434cca5681df68065be05923bbab2
MD5 31937ca7332db6640727515aee913ce2
BLAKE2b-256 16dc7e25070a4ebd1d67acc84ab8a926ae36a604a4d231953006fee3070d298a

See more details on using hashes here.

Provenance

The following attestation bundles were made for vizro_dash_components-0.1.1.tar.gz:

Publisher: release-if-needed.yml on mckinsey/vizro

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vizro_dash_components-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for vizro_dash_components-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5017c47f4ce57a786d475200e58477327b4052e4adc0db5a4afddb17bb3e4860
MD5 4aaafbf3d7a10d4861b5e01c2f38c995
BLAKE2b-256 1e1c7fa3e0191b9a7ca9295d972ebe7219dd3d9dc7d7df33f6f70955a2ffdbb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for vizro_dash_components-0.1.1-py3-none-any.whl:

Publisher: release-if-needed.yml on mckinsey/vizro

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page