dlt._workspace.helpers.dashboard.utils.ui
Dashboard UI helpers: tables, callouts, section boilerplate, and shared utilities.
BoundedDict Objects
class BoundedDict(Dict[Any, Any])
Dict that evicts the oldest entry when maxsize is exceeded.
dlt_table
def dlt_table(data: Union[List[Dict[str, Any]], pyarrow.Table],
*,
selection: Optional[str] = None,
style: bool = True,
freeze_column: Optional[str] = "name",
initial_selection: Optional[List[int]] = None,
pagination: Optional[bool] = None,
show_download: Optional[bool] = None,
**kwargs: Any) -> mo.ui.table
Create a styled mo.ui.table with common dashboard defaults.
Applies alternating-row styling, freezes the given column, aligns dict keys, and sets initial_selection to None when data is empty.
Arguments:
data- Table data as a list of dicts or a pyarrow Table.selection- Selection mode ("single", "multi") or None to disable.style- Whether to apply alternating-row cell styling.freeze_column- Column name to freeze on the left. Pass None to disable.initial_selection- Row indices to pre-select. Forced to None when data is empty.pagination- Passed through to mo.ui.table.show_download- Passed through to mo.ui.table.
small
def small(text: str) -> str
Wrap text in <small> HTML tags for consistent dashboard styling.
error_callout
def error_callout(message: str,
code: str = None,
traceback_string: str = None) -> mo.Html
Build a callout with a message and a exposable stacktrace.
Arguments:
messagestr - The message to display in the callout.codestr - The code to display in the callout.traceback_stringstr - The traceback to display in the callout.
Returns:
mo.ui.Callout- The callout with the message and the stacktrace.
title_and_subtitle
def title_and_subtitle(title: str,
subtitle: str = None,
title_level: int = 3) -> mo.Html
Build a title and a subtitle block
page_header
def page_header(dlt_pipeline: dlt.Pipeline,
section_strings: TSectionStrings,
button: mo.ui.switch = None) -> List[mo.Html]
Build a page header with a title, a subtitle, button and conditional longer subtitle.
When collapsed, the short subtitle is shown inline after the title to save vertical space. When expanded, the longer subtitle appears on its own line.
section_marker
def section_marker(section_name: str, has_content: bool = False) -> mo.Html
Create an invisible marker element to identify sections for CSS styling.
Arguments:
section_name- Name identifier for the section (e.g., "home_section", "schema_section")has_content- If True, adds 'has-content' class to enable CSS styling (borders, backgrounds). Should be True only when the section has actual content and is displayed.
Returns:
Hidden HTML div element with section marker classes for CSS targeting.
section
def section(section_strings: TSectionStrings, dlt_pipeline: dlt.Pipeline,
switch: mo.ui.switch) -> Tuple[List[mo.Html], bool]
Build standard section boilerplate: marker + page header.
Returns:
Tuple of (result list, should_render_content). The list already
contains the section marker and header. Append content only when
should_render_content is True, then call mo.vstack(result).