Vizro writing-vizro-yaml
Use this skill when writing or debugging Vizro YAML dashboard configurations — component syntax, data_manager registration, custom function wiring, filter/parameter setup, or AG Grid tables. Activate when the user is building a Vizro app, encountering YAML or runtime errors, or asking about Vizro component patterns.
install
source · Clone the upstream repo
git clone https://github.com/mckinsey/vizro
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/mckinsey/vizro "$T" && mkdir -p ~/.claude/skills && cp -r "$T/vizro-e2e-flow/skills/writing-vizro-yaml" ~/.claude/skills/mckinsey-vizro-writing-vizro-yaml && rm -rf "$T"
manifest:
vizro-e2e-flow/skills/writing-vizro-yaml/SKILL.mdsource content
Vizro YAML & Component Reference
Critical Mistakes to Avoid
Each mistake below is expanded with code examples and fixes in yaml-reference.md.
receives a DataFrame — use@capture("graph")
directly; never re-lookup viadata_frame
(causes blank charts).data_manager[data_frame]
is not subscriptable — pre-process on raw DataFrame, then register.data_manager- Custom
needs module prefix —_target_
, not_target_: custom_charts.my_chart
._target_: my_chart
has notype: figure
field — KPI titles go intitle
args._target_: kpi_card
requirestype: ag_grid
._target_: dash_ag_grid- Parameter targets — format:
, not"component_id.argument_name"
."component_id.figure" - Quote YAML special chars in column names —
(unquotedcolumn: "Version #"
starts a comment).# - Filter
— omit when you want to apply it to all components on the page whose data source includes defined filtertargets:
.column - Grid must be rectangular — same component index must span same columns in every row.
- Column type consistency — filter column must have same dtype across all targeted datasets.
Quick Patterns
# Standard chart (scatter — no aggregation needed, each row is one point) - figure: _target_: scatter data_frame: sales_data x: units y: revenue type: graph title: Revenue vs Units # KPI card (title inside figure args, NOT on component) - figure: _target_: kpi_card data_frame: kpi_data value_column: Revenue title: Total Revenue value_format: "${value:,.0f}" type: figure # AG Grid table - figure: _target_: dash_ag_grid data_frame: sales_data type: ag_grid title: Sales Data # Filter with targets controls: - column: region targets: [chart_1, chart_2] type: filter
Key Imports
import vizro.models as vm from vizro import Vizro import vizro.plotly.express as px from vizro.tables import dash_ag_grid from vizro.figures import kpi_card, kpi_card_reference from vizro.models.types import capture from vizro.managers import data_manager from vizro.themes import palettes, colors
Deep Dive
Load yaml-reference.md when you need expanded guidance. Key sections to search for:
| Need | Search for |
|---|---|
| App structure | |
| Data registration | |
| Custom charts | |
| AG Grid (heatmap, inline bars) | |
| Containers / Tabs | or |
| Expanded mistake fixes | |