Skip to main content

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 leaves. Supports single-select and multi-select, and two value modes selected by full_path (see value format below). 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.

value format

The shape of value depends on the full_path prop (default False):

  • Leaf mode (full_path=False, default): value is the bare leaf scalar, for example "Paris"; when multi=True it is a list of leaf scalars, for example ["Paris", "Tokyo"]. Leaf values must be unique across the whole tree — a duplicate leaf value under two branches is ambiguous in this mode (the component logs a console error). This is a constraint on value, not label: two leaves may share a label as long as their values differ.
  • Path mode (full_path=True): value is the full root-to-leaf path: a list of node values from the root down to the selected leaf, for example ["Europe", "France", "Paris"]; when multi=True it is a list of such paths, for example [["Europe", "France", "Paris"], ["Asia", "Japan", "Tokyo"]]. Because paths are used, duplicate leaf values in different branches (for example a "Portland" under both "Oregon" and "Maine") are addressed unambiguously.
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):
    # Default leaf mode: `value` is the bare leaf, for example "Tokyo".
    # Pass full_path=True to get the full path instead, for example ["Asia", "Japan", "Tokyo"].
    return f"Selected: {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).

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.3.0.tar.gz (887.3 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.3.0-py3-none-any.whl (829.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for vizro_dash_components-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ba80928236590ac77ba3aeb01f52cbc39d3cf3a5398527aef82a14e33471b72c
MD5 22e69b252c822135e0b337263acdc7c4
BLAKE2b-256 f8f830116f689ad6a07ca18d3d62c67953c19fb75000b875afea5c05e50adf40

See more details on using hashes here.

Provenance

The following attestation bundles were made for vizro_dash_components-0.3.0.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.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vizro_dash_components-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29eaa876fad7279042373ddc0441703c7b699aec78dbe0da5229c2a048f066b3
MD5 e36c68873b77a6d51db81980bd8ad061
BLAKE2b-256 f8dd382141b71ae3a20531b060d056f46463473fa9f9368f5adf1120e7d97c1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for vizro_dash_components-0.3.0-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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page