Models
vizro.models
Vizro pydantic models, typically aliased as vm using import vizro.models as vm.
Accordion
Accordion to be used as nav_selector in Navigation.
Usage documentation
Parameters:
-
pages(dict[str, list[ModelID]]) –Mapping from name of a pages group to a list of page IDs/titles. Defaults to
{}.
Action
Custom action to be inserted into actions of source component.
Usage documentation
Parameters:
-
function(CapturedCallable) –Custom action function.
-
inputs(list[str]) –List of inputs provided to the action function. Each input can be specified as
<model_id>or<model_id>.<argument_name>or<component_id>.<property>. Defaults to[]. ❗Deprecated:inputsis deprecated and will not exist in Vizro 0.2.0. -
outputs(OutputsType) –See
OutputsType.
AgGrid
Wrapper for dash_ag_grid.AgGrid to visualize grids in dashboard.
Usage documentation
Parameters:
-
figure(CapturedCallable) –Function that returns a Dash AgGrid. See
vizro.tables. -
title(str) –Title of the
AgGrid. Defaults to"". -
header(str) –Markdown text positioned below the
AgGrid.title. Follows the CommonMark specification. Ideal for adding supplementary information such as subtitles, descriptions, or additional context. Defaults to"". -
footer(str) –Markdown text positioned below the
AgGrid. Follows the CommonMark specification. Ideal for providing further details such as sources, disclaimers, or additional notes. Defaults to"". -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. Defaults to
None. -
actions(ActionsType) –See
ActionsType.
Button
Button that can trigger actions or navigate.
Usage documentation
Parameters:
-
icon(str) –Icon name from Google Material icons library. Defaults to
"". -
text(str) –Text to be displayed on button. Defaults to
"Click me!". -
href(str) –URL (relative or absolute) to navigate to. Defaults to
"". -
actions(ActionsType) –See
ActionsType. -
variant(Literal['plain', 'filled', 'outlined']) –Predefined styles to choose from. Options are
plain,filledoroutlined. Defaults tofilled. -
description(Tooltip | None) –Optional markdown string that adds an icon next to the button text. Hovering over the icon shows a tooltip with the provided description. Defaults to
None. -
extra(dict[str, Any]) –Extra keyword arguments that are passed to
dbc.Buttonand overwrite any defaults chosen by the Vizro team. This may have unexpected behavior. Visit the dbc documentation to see all available arguments. Not part of the official Vizro schema and the underlying component may change in the future. Defaults to{}.
Card
Card based on Markdown syntax.
Usage documentation
Parameters:
-
text(str) –Markdown string to create card title/text that should adhere to the CommonMark Spec.
-
header(str) –Markdown text positioned above the card text. Follows the CommonMark specification. Ideal for adding supplementary information. Defaults to
"". -
footer(str) –Markdown text positioned at the bottom of the
Card. Follows the CommonMark specification. Ideal for providing further details such as sources, disclaimers, or additional notes. Defaults to"". -
href(str) –URL (relative or absolute) to navigate to. If not provided the Card serves as a text card only. Defaults to
"". -
description(Tooltip | None) –Optional markdown string that adds an icon in the top-right corner of the Card. Hovering over the icon shows a tooltip with the provided description. Defaults to
None. -
extra(dict[str, Any]) –Extra keyword arguments that are passed to
dbc.Cardand overwrite any defaults chosen by the Vizro team. This may have unexpected behavior. Visit the dbc documentation to see all available arguments. Not part of the official Vizro schema and the underlying component may change in the future. Defaults to{}. -
actions(ActionsType) –See
ActionsType.
Checklist
Categorical multi-option selector.
Can be provided to Filter or Parameter.
Usage documentation
Parameters:
-
options(OptionsType) –See
OptionsType. Defaults to[]. -
value(MultiValueType | None) –See
MultiValueType. Defaults toNone. -
title(str) –Title to be displayed. Defaults to
"". -
show_select_all(bool) –Whether to display the 'Select All' option that allows users to select or deselect all available options with a single click. Defaults to
True. -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. Defaults to
None. -
actions(ActionsType) –See
ActionsType. -
extra(dict[str, Any]) –Extra keyword arguments that are passed to
dbc.Checklistand overwrite any defaults chosen by the Vizro team. This may have unexpected behavior. Visit the dbc documentation to see all available arguments. Not part of the official Vizro schema and the underlying component may change in the future. Defaults to{}.
Container
Container to group together a set of components on a page.
Usage documentation
Parameters:
-
components(list[ComponentType]) –See ComponentType. At least one component has to be provided.
-
title(str) –Title of the
Container. Defaults to"". -
layout(LayoutType | None) –Layout to place components in. Defaults to
None. -
collapsed(bool | None) –Boolean flag that determines whether the container is collapsed on initial load. Set to
Truefor a collapsed state,Falsefor an expanded state. Defaults toNone, meaning the container is not collapsible. -
variant(Literal['plain', 'filled', 'outlined'] | None) –Predefined styles to choose from. Options are
plain,filledoroutlined. Defaults toplain(oroutlinedfor collapsible container). -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. Defaults to
None. -
controls(list[ControlType]) –See ControlType. Defaults to
[]. -
extra(dict[str, Any]) –Extra keyword arguments that are passed to
dbc.Containerand overwrite any defaults chosen by the Vizro team. This may have unexpected behavior. Visit the dbc documentation to see all available arguments. Not part of the official Vizro schema and the underlying component may change in the future. Defaults to{}.
Dashboard
Dashboard that is supplied to Vizro.build.
Usage documentation
Parameters:
-
pages(list[Page]) –See
Page. -
theme(Literal['vizro_dark', 'vizro_light']) –Layout theme to be applied across dashboard. Defaults to
vizro_dark. -
navigation(Navigation) –See
Navigation. Defaults toNone. -
title(str) –Dashboard title to appear on every page on top left-side. Defaults to
"". -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. This also sets the page's meta tags. Defaults to
None.
custom_header
Adds custom content that will appear to the left of the theme switch.
Returns:
-
Component | list[Component]–A Dash component of list of components for the dashboard header's custom content area.
DatePicker
Temporal single/range option selector.
Can be provided to Filter or Parameter.
Usage documentation
Parameters:
-
min(date | None) –Start date for date picker. Defaults to
None. -
max(date | None) –End date for date picker. Defaults to
None. -
value(list[date] | date | None) –Default date/dates for date picker. Defaults to
None. -
title(str) –Title to be displayed. Defaults to
"". -
range(bool) –Boolean flag for displaying range picker. Defaults to
True. -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. Defaults to
None. -
actions(ActionsType) –See
ActionsType. -
extra(dict[str, Any]) –Extra keyword arguments that are passed to
dmc.DatePickerInputand overwrite any defaults chosen by the Vizro team. This may have unexpected behavior. Visit the dmc documentation to see all available arguments. Not part of the official Vizro schema and the underlying component may change in the future. Defaults to{}.
Dropdown
Categorical single/multi-option selector.
Can be provided to Filter or
Parameter.
Usage documentation
Parameters:
-
options(OptionsType) –See
OptionsType. Defaults to[]. -
value(SingleValueType | MultiValueType | None) –See
SingleValueTypeandMultiValueType. Defaults toNone. -
multi(bool) –Whether to allow selection of multiple values. Defaults to
True. -
title(str) –Title to be displayed. Defaults to
"". -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. Defaults to
None. -
actions(ActionsType) –See
ActionsType. -
extra(dict[str, Any]) –Extra keyword arguments that are passed to
dcc.Dropdownand overwrite any defaults chosen by the Vizro team. This may have unexpected behavior. Visit the dcc documentation to see all available arguments. Not part of the official Vizro schema and the underlying component may change in the future. Defaults to{}.
Figure
Object that is reactive to controls, for example a KPI card.
Usage documentation
Parameters:
-
figure(CapturedCallable) –Function that returns a figure-like object. See
vizro.figures. -
actions(ActionsType) –See
ActionsType.
Filter
Filter the data supplied to targets.
Usage documentation
Parameters:
-
column(str) –Column of
DataFrameto filter. -
targets(list[ModelID]) –Target component to be affected by filter. If none are given then target all components on the page that use
column. Defaults to[]. -
selector(SelectorType | None) –See SelectorType. Defaults to
None. -
show_in_url(bool) –Whether the filter should be included in the URL query string. Defaults to
False. Useful for bookmarking or sharing dashboards with specific filter values pre-set. -
visible(bool) –Whether the filter should be visible. Defaults to
True.
Flex
Flex layout for components on a Page or in a Container.
Usage documentation
Parameters:
-
direction(Literal['row', 'column']) –Sets the direction of the flex items inside the container. Options are
roworcolumn. Defaults tocolumn. -
gap(str) –Specifies the gap between rows and columns. Allowed units: 'px', 'rem', 'em', or '%'. Defaults to
24px. -
wrap(bool) –Determines whether flex items are forced onto a single line or can wrap onto multiple lines. If
False, all items will be on one line. IfTrue, items will wrap onto multiple lines. Defaults toFalse.
Graph
Wrapper for dcc.Graph to visualize charts.
Usage documentation
Parameters:
-
figure(CapturedCallable) –Function that returns a graph. Either use
vizro.plotly.expressor seeCapturedCallable. -
title(str) –Title of the
Graph. Defaults to"". -
header(str) –Markdown text positioned below the
Graph.title. Follows the CommonMark specification. Ideal for adding supplementary information such as subtitles, descriptions, or additional context. Defaults to"". -
footer(str) –Markdown text positioned below the
Graph. Follows the CommonMark specification. Ideal for providing further details such as sources, disclaimers, or additional notes. Defaults to"". -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. Defaults to
None. -
actions(ActionsType) –See
ActionsType. -
extra(dict[str, Any]) –Extra keyword arguments that are passed to
dcc.Graphand overwrite any defaults chosen by the Vizro team. This may have unexpected behavior. Visit the dcc documentation to see all available arguments. Not part of the official Vizro schema and the underlying component may change in the future. Defaults to{}.
Grid
Grid layout for components on a Page or in a Container.
Usage documentation
Parameters:
-
grid(list[list[int]]) –Grid specification to arrange components on screen.
-
row_gap(str) –Specifies the gap between rows. Allowed units: 'px', 'rem', 'em', or '%'. Defaults to
24px. -
col_gap(str) –Specifies the gap between columns. Allowed units: 'px', 'rem', 'em', or '%'. Defaults to
24px. -
row_min_height(str) –Minimum row height in px. Allowed units: 'px', 'rem', 'em', or '%'. Defaults to
0px. -
col_min_width(str) –Minimum column width in px. Allowed unit are: 'px', 'rem', 'em', or '%'. Defaults to
0px.
Layout
deprecated
Deprecated
The Layout model has been renamed Grid, and Layout will not exist in Vizro 0.2.0.
NavBar
NavLink
Icon that serves as a navigation link to be used in a NavBar.
Usage documentation
Parameters:
-
pages(NavPagesType) –See
NavPagesType. Defaults to[]. -
label(str) –Text description of the icon for use in tooltip.
-
icon(str) –Icon name from Google Material icons library. Defaults to
"".
Navigation
Navigation to arrange hierarchy of Pages.
Usage documentation
Parameters:
-
pages(NavPagesType) –See
NavPagesType. Defaults to[]. -
nav_selector(NavSelectorType | None) –See
NavSelectorType. Defaults toNone.
Page
A page in Dashboard with its own URL path and place in the Navigation.
Usage documentation
Parameters:
-
components(list[ComponentType]) –See ComponentType. At least one component has to be provided.
-
title(str) –Title of the
Page. -
layout(LayoutType | None) –Layout to place components in. Defaults to
None. -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. This also sets the page's meta tags. Defaults to
None. -
controls(list[ControlType]) –See ControlType. Defaults to
[]. -
path(str) –Path to navigate to page. Defaults to
"". -
actions(ActionsType) –See
ActionsType.
Parameter
Alter the arguments supplied to any targets.
Usage documentation
Example
Parameters:
-
targets(list[str]) –Targets in the form of
<target_component>.<target_argument>. -
selector(SelectorType) –See SelectorType. Converts selector value
"NONE"intoNoneto allow optional parameters. -
show_in_url(bool) –Whether the parameter should be included in the URL query string. Defaults to
False. Useful for bookmarking or sharing dashboards with specific parameter values pre-set. -
visible(bool) –Whether the parameter should be visible. Defaults to
True.
RadioItems
Categorical single-option selector.
Can be provided to Filter or
Parameter.
Usage documentation
Parameters:
-
options(OptionsType) –See
OptionsType. Defaults to[]. -
value(SingleValueType | None) –See
SingleValueType. Defaults toNone. -
title(str) –Title to be displayed. Defaults to
"". -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. Defaults to
None. -
actions(ActionsType) –See
ActionsType. -
extra(dict[str, Any]) –Extra keyword arguments that are passed to
dbc.RadioItemsand overwrite any defaults chosen by the Vizro team. This may have unexpected behavior. Visit the dbc documentation to see all available arguments. Not part of the official Vizro schema and the underlying component may change in the future. Defaults to{}.
RangeSlider
Numeric multi-option selector.
Can be provided to Filter or
Parameter.
Usage documentation
Parameters:
-
min(float | None) –Start value for slider. Defaults to
None. -
max(float | None) –End value for slider. Defaults to
None. -
step(float | None) –Step-size for marks on slider. Defaults to
None. -
marks(dict[float, str]) –Marks to be displayed on slider. Defaults to
{}. -
value(list[float] | None) –Default start and end value for slider. Must be 2 items. Defaults to
None. -
title(str) –Title to be displayed. Defaults to
"". -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. Defaults to
None. -
actions(ActionsType) –See
ActionsType. -
extra(dict[str, Any]) –Extra keyword arguments that are passed to
dcc.RangeSliderand overwrite any defaults chosen by the Vizro team. This may have unexpected behavior. Visit the dcc documentation to see all available arguments. Not part of the official Vizro schema and the underlying component may change in the future. Defaults to{}.
Slider
Numeric single-option selector.
Can be provided to Filter or
Parameter.
Usage documentation
Parameters:
-
min(float | None) –Start value for slider. Defaults to
None. -
max(float | None) –End value for slider. Defaults to
None. -
step(float | None) –Step-size for marks on slider. Defaults to
None. -
marks(dict[float, str]) –Marks to be displayed on slider. Defaults to
{}. -
value(float | None) –Default value for slider. Defaults to
None. -
title(str) –Title to be displayed. Defaults to
"". -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. Defaults to
None. -
actions(ActionsType) –See
ActionsType. -
extra(dict[str, Any]) –Extra keyword arguments that are passed to
dcc.Sliderand overwrite any defaults chosen by the Vizro team. This may have unexpected behavior. Visit the dcc documentation to see all available arguments. Not part of the official Vizro schema and the underlying component may change in the future. Defaults to{}.
Switch
Boolean single-option selector.
Can be provided to Filter or Parameter.
Usage documentation
Parameters:
-
value(bool) –Initial state of the switch. When
True, the switch is "on". WhenFalse, the switch is "off". Defaults toFalse. -
title(str) –Title/Label to be displayed to the right of the switch. Defaults to
"". -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. Defaults to
None. -
actions(ActionsType) –See
ActionsType. -
extra(dict[str, Any]) –Extra keyword arguments that are passed to
dbc.Switchand overwrite any defaults chosen by the Vizro team. This may have unexpected behavior. Visit the dbc documentation to see all available arguments. Not part of the official Vizro schema and the underlying component may change in the future. Defaults to{}.
Table
Wrapper for dash_table.DataTable to visualize tables in dashboard.
Usage documentation
Parameters:
-
figure(CapturedCallable) –Function that returns a Dash DataTable. See
vizro.tables. -
title(str) –Title of the
Table. Defaults to"". -
header(str) –Markdown text positioned below the
Table.title. Follows the CommonMark specification. Ideal for adding supplementary information such as subtitles, descriptions, or additional context. Defaults to"". -
footer(str) –Markdown text positioned below the
Table. Follows the CommonMark specification. Ideal for providing further details such as sources, disclaimers, or additional notes. Defaults to"". -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. Defaults to
None. -
actions(ActionsType) –See
ActionsType.
Tabs
Tabs to group together a set of Containers.
Usage documentation
Parameters:
-
tabs(list[Container]) –See
Container. -
title(str) –Title displayed above Tabs. Defaults to
"". -
description(Tooltip | None) –Optional markdown string that adds an icon next to the title. Hovering over the icon shows a tooltip with the provided description. Defaults to
None.
Text
Text based on Markdown syntax.
Usage documentation
Parameters:
-
text(str) –Markdown string to create text that should adhere to the CommonMark Spec.
-
extra(dict[str, Any]) –Extra keyword arguments that are passed to
dcc.Markdownand overwrite any defaults chosen by the Vizro team. This may have unexpected behavior. Visit the dcc documentation to see all available arguments. Not part of the official Vizro schema and the underlying component may change in the future. Defaults to{}.
Tooltip
A tooltip that displays text when hovering over an icon.
Usage documentation
Read more about usage in the guides on dashboards, pages, containers, graphs, tables, tabs, selectors and buttons.
Parameters:
-
text(str) –Markdown string for text shown when hovering over the icon. Should adhere to the CommonMark Spec.
-
icon(str) –Icon name from Google Material icons library.
-
extra(dict[str, Any]) –Extra keyword arguments that are passed to
dbc.Tooltipand overwrite any chosen by the Vizro team. This may have unexpected behavior. Visit the dbc documentation to see all available arguments. Not part of the official Vizro schema and the underlying component may change in the future. Defaults to{}.
Tooltip on a Checklist selector
VizroBaseModel
All Vizro models inherit from this class.
Usage documentation
Parameters:
-
id(ModelID) –ID to identify model. Must be unique throughout the whole dashboard. When no ID is chosen, ID will be automatically generated.
vizro.models.types
Types used in pydantic fields.
ActionType
module-attribute
ActionType = Annotated[
Annotated["Action", Tag("action")]
| Annotated["export_data", Tag("export_data")]
| Annotated[
"filter_interaction", Tag("filter_interaction")
]
| Annotated["set_control", Tag("set_control")]
| SkipJsonSchema[Annotated["_filter", Tag("_filter")]]
| SkipJsonSchema[
Annotated["_parameter", Tag("_parameter")]
]
| SkipJsonSchema[
Annotated["_on_page_load", Tag("_on_page_load")]
],
Field(
discriminator=Discriminator(
_get_action_discriminator
),
description="Action.",
),
]
Discriminated union. Type of action: Action, export_data or
filter_interaction.
ActionsType
module-attribute
List of actions that can be triggered by a component. Accepts either a single
ActionType or a list of ActionType.
Defaults to [].
ComponentType
module-attribute
ControlType
module-attribute
LayoutType
module-attribute
MultiValueType
module-attribute
Permissible value types for multi-value selectors. Values are displayed as default.
NavPagesType
module-attribute
List of page IDs or a mapping from name of a group to a list of page IDs (for hierarchical sub-navigation).
NavSelectorType
module-attribute
OptionsType
module-attribute
Permissible options types for selectors. Options are available choices for user to select from.
OutputsType
module-attribute
OutputsType = Annotated[
list[str] | dict[str, str],
BeforeValidator(_coerce_to_list),
Field(default=[]),
]
List or dictionary of outputs modified by the action function. Accepts either a single string,
a list of strings, or a dictionary mapping strings to strings. Each output can be specified as
<model_id> or <model_id>.<argument_name> or <component_id>.<property>. Defaults to [].
SelectorType
module-attribute
SelectorType = Annotated[
"Checklist | DatePicker | Dropdown | RadioItems | RangeSlider | Slider | Switch",
Field(
discriminator="type",
description="Selectors to be used inside a control.",
),
]
Discriminated union. Type of selector to be used inside a control: Checklist,
DatePicker, Dropdown, RadioItems,
RangeSlider, Slider or Switch.
SingleValueType
module-attribute
Permissible value types for single-value selectors. Values are displayed as default.
CapturedCallable
Stores a captured function call to use in a dashboard.
Users do not need to instantiate this class directly. Instances are instead generated automatically
through the capture decorator.
capture
Captures a function call to create a custom CapturedCallable.
Usage documentation
How to create custom actions, How to create custom charts, How to create custom tables, How to create figures.
Parameters:
-
mode(Literal['graph', 'action', 'table', 'ag_grid', 'figure']) –The mode of the captured callable.