CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-streamlit

A faster way to build and share data apps

Overview
Eval results
Files

display-elements.mddocs/

Display Elements

Core functions for displaying text, data, charts, and media content. These functions form the foundation of Streamlit's visualization capabilities and enable rich content presentation without HTML knowledge.

Capabilities

Text Display

Functions for displaying formatted text content with various styling and formatting options.

def title(body, anchor=None, *, help=None):
    """
    Display large title text as the main heading of the app.

    Args:
        body (str): The text to display
        anchor (str, optional): The anchor name for the header
        help (str, optional): Tooltip text
    """

def header(body, anchor=None, *, help=None, divider=False):
    """
    Display header text as a section heading.

    Args:
        body (str): The text to display
        anchor (str, optional): The anchor name for the header
        help (str, optional): Tooltip text
        divider (bool): Whether to show a divider line below
    """

def subheader(body, anchor=None, *, help=None, divider=False):
    """
    Display subheader text as a subsection heading.

    Args:
        body (str): The text to display
        anchor (str, optional): The anchor name for the header
        help (str, optional): Tooltip text
        divider (bool): Whether to show a divider line below
    """

def caption(body, *, help=None):
    """
    Display small caption text in muted color.

    Args:
        body (str): The text to display
        help (str, optional): Tooltip text
    """

def text(body, *, help=None):
    """
    Display fixed-width preformatted text.

    Args:
        body (str): The text to display
        help (str, optional): Tooltip text
    """

def markdown(body, *, unsafe_allow_html=False, help=None):
    """
    Display Markdown-formatted text with rich formatting support.

    Args:
        body (str): Markdown text to display
        unsafe_allow_html (bool): Whether to allow HTML in markdown
        help (str, optional): Tooltip text
    """

def latex(body, *, help=None):
    """
    Display LaTeX mathematical expressions using KaTeX.

    Args:
        body (str): LaTeX expression to display
        help (str, optional): Tooltip text
    """

def code(body, language=None, *, line_numbers=False, help=None):
    """
    Display code block with syntax highlighting.

    Args:
        body (str): Code to display
        language (str, optional): Programming language for syntax highlighting
        line_numbers (bool): Whether to show line numbers
        help (str, optional): Tooltip text
    """

def html(body, *, help=None):
    """
    Display raw HTML content.

    Args:
        body (str): HTML content to display
        help (str, optional): Tooltip text
    """

def divider():
    """Display a horizontal divider line."""

Data Display

Functions for displaying structured data including tables, dataframes, and key metrics.

def dataframe(data, width=None, height=None, *, use_container_width=False, hide_index=None, column_order=None, column_config=None):
    """
    Display interactive dataframe with sorting, filtering, and selection.

    Args:
        data: pandas DataFrame, numpy array, or dict-like data
        width (int, optional): Width in pixels
        height (int, optional): Height in pixels
        use_container_width (bool): Whether to use full container width
        hide_index (bool, optional): Whether to hide the index column
        column_order (list, optional): Order of columns to display
        column_config (dict, optional): Column configuration mapping

    Returns:
        The displayed data selection if interactive
    """

def data_editor(data, width=None, height=None, *, use_container_width=False, hide_index=None, column_order=None, column_config=None, num_rows="fixed", disabled=None, key=None, on_change=None):
    """
    Display editable dataframe with full editing capabilities.

    Args:
        data: pandas DataFrame, numpy array, or dict-like data
        width (int, optional): Width in pixels
        height (int, optional): Height in pixels
        use_container_width (bool): Whether to use full container width
        hide_index (bool, optional): Whether to hide the index column
        column_order (list, optional): Order of columns to display
        column_config (dict, optional): Column configuration mapping
        num_rows (str): Row editing mode ("fixed", "dynamic")
        disabled (bool or list): Disable editing for columns
        key (str, optional): Widget key for state management
        on_change (callable, optional): Callback when data changes

    Returns:
        The edited dataframe
    """

def table(data, *, help=None):
    """
    Display static table without interactive features.

    Args:
        data: pandas DataFrame, numpy array, or dict-like data
        help (str, optional): Tooltip text
    """

def metric(label, value, delta=None, *, delta_color="normal", help=None, label_visibility="visible"):
    """
    Display key metric with optional delta indicator.

    Args:
        label (str): Metric label
        value (str or number): Metric value
        delta (str or number, optional): Change from previous value
        delta_color (str): Color of delta ("normal", "inverse", "off")
        help (str, optional): Tooltip text
        label_visibility (str): Label visibility ("visible", "hidden", "collapsed")
    """

def json(body, *, expanded=False, help=None):
    """
    Display JSON data as expandable tree structure.

    Args:
        body: JSON-serializable object
        expanded (bool): Whether to start expanded
        help (str, optional): Tooltip text
    """

Chart Display

Built-in charting functions for common visualization types with automatic formatting and interactivity.

def line_chart(data, *, x=None, y=None, color=None, width=None, height=None, use_container_width=False, help=None):
    """
    Display line chart connecting data points.

    Args:
        data: pandas DataFrame or dict-like data
        x (str, optional): Column name for x-axis
        y (str or list, optional): Column name(s) for y-axis
        color (str, optional): Column name for color grouping
        width (int, optional): Chart width in pixels
        height (int, optional): Chart height in pixels
        use_container_width (bool): Whether to use full container width
        help (str, optional): Tooltip text
    """

def area_chart(data, *, x=None, y=None, color=None, width=None, height=None, use_container_width=False, help=None):
    """
    Display area chart with filled regions under lines.

    Args:
        data: pandas DataFrame or dict-like data
        x (str, optional): Column name for x-axis
        y (str or list, optional): Column name(s) for y-axis
        color (str, optional): Column name for color grouping
        width (int, optional): Chart width in pixels
        height (int, optional): Chart height in pixels
        use_container_width (bool): Whether to use full container width
        help (str, optional): Tooltip text
    """

def bar_chart(data, *, x=None, y=None, color=None, width=None, height=None, use_container_width=False, help=None):
    """
    Display bar chart with categorical data.

    Args:
        data: pandas DataFrame or dict-like data
        x (str, optional): Column name for x-axis
        y (str or list, optional): Column name(s) for y-axis
        color (str, optional): Column name for color grouping
        width (int, optional): Chart width in pixels
        height (int, optional): Chart height in pixels
        use_container_width (bool): Whether to use full container width
        help (str, optional): Tooltip text
    """

def scatter_chart(data, *, x=None, y=None, color=None, size=None, width=None, height=None, use_container_width=False, help=None):
    """
    Display scatter plot with individual data points.

    Args:
        data: pandas DataFrame or dict-like data
        x (str, optional): Column name for x-axis
        y (str, optional): Column name for y-axis
        color (str, optional): Column name for color grouping
        size (str, optional): Column name for point size
        width (int, optional): Chart width in pixels
        height (int, optional): Chart height in pixels
        use_container_width (bool): Whether to use full container width
        help (str, optional): Tooltip text
    """

def map(data, *, latitude=None, longitude=None, color=None, size=None, zoom=None, use_container_width=False, help=None):
    """
    Display map with data points overlaid on geographic coordinates.

    Args:
        data: pandas DataFrame with geographic data
        latitude (str, optional): Column name for latitude values
        longitude (str, optional): Column name for longitude values
        color (str, optional): Column name for color grouping
        size (str, optional): Column name for point size
        zoom (int, optional): Initial zoom level
        use_container_width (bool): Whether to use full container width
        help (str, optional): Tooltip text
    """

Advanced Charts

Integration with popular charting libraries for sophisticated visualizations.

def altair_chart(altair_chart, *, use_container_width=False, help=None):
    """
    Display Altair/Vega-Lite chart with full customization.

    Args:
        altair_chart: Altair Chart object
        use_container_width (bool): Whether to use full container width
        help (str, optional): Tooltip text
    """

def vega_lite_chart(data, spec, *, use_container_width=False, help=None):
    """
    Display chart using Vega-Lite specification.

    Args:
        data: Chart data
        spec (dict): Vega-Lite specification
        use_container_width (bool): Whether to use full container width
        help (str, optional): Tooltip text
    """

def plotly_chart(figure_or_data, *, use_container_width=False, sharing="streamlit", help=None):
    """
    Display interactive Plotly chart with full interactivity.

    Args:
        figure_or_data: Plotly Figure object or data
        use_container_width (bool): Whether to use full container width
        sharing (str): Sharing mode for Plotly
        help (str, optional): Tooltip text
    """

def bokeh_chart(figure, *, use_container_width=False, help=None):
    """
    Display Bokeh plot with interactive capabilities.

    Args:
        figure: Bokeh Figure object
        use_container_width (bool): Whether to use full container width
        help (str, optional): Tooltip text
    """

def pyplot(fig=None, *, clear_figure=None, use_container_width=False, help=None):
    """
    Display Matplotlib figure with optional automatic clearing.

    Args:
        fig (matplotlib.figure.Figure, optional): Figure to display
        clear_figure (bool, optional): Whether to clear figure after display
        use_container_width (bool): Whether to use full container width
        help (str, optional): Tooltip text
    """

def graphviz_chart(figure_or_dot, *, use_container_width=False, help=None):
    """
    Display Graphviz diagram from DOT notation or figure.

    Args:
        figure_or_dot: Graphviz figure or DOT string
        use_container_width (bool): Whether to use full container width
        help (str, optional): Tooltip text
    """

def pydeck_chart(pydeck_obj, *, use_container_width=False, help=None):
    """
    Display 3D visualization using PyDeck for geographic data.

    Args:
        pydeck_obj: PyDeck chart object
        use_container_width (bool): Whether to use full container width
        help (str, optional): Tooltip text
    """

Media Display

Functions for displaying images, audio, video, and document content.

def image(image, caption=None, width=None, *, use_column_width=None, clamp=False, channels="RGB", output_format="auto", help=None):
    """
    Display image with optional caption and sizing controls.

    Args:
        image: PIL Image, numpy array, or image URL/path
        caption (str, optional): Image caption
        width (int, optional): Image width in pixels
        use_column_width (bool, optional): Whether to use column width
        clamp (bool): Whether to clamp image values to valid range
        channels (str): Color channel format ("RGB", "BGR")
        output_format (str): Output format ("PNG", "JPEG", "auto")
        help (str, optional): Tooltip text
    """

def audio(data, *, format="audio/wav", start_time=0, sample_rate=None, help=None, loop=False, autoplay=False, end_time=None):
    """
    Display audio player with playback controls.

    Args:
        data: Audio data as bytes, file path, or URL
        format (str): MIME type of audio format
        start_time (int): Start playback time in seconds
        sample_rate (int, optional): Sample rate for raw audio
        help (str, optional): Tooltip text
        loop (bool): Whether to loop playback
        autoplay (bool): Whether to start playing automatically
        end_time (int, optional): End playback time in seconds
    """

def video(data, *, format="video/mp4", start_time=0, help=None, loop=False, autoplay=False, subtitles=None, end_time=None, muted=False):
    """
    Display video player with full playback controls.

    Args:
        data: Video data as bytes, file path, or URL
        format (str): MIME type of video format
        start_time (int): Start playback time in seconds
        help (str, optional): Tooltip text
        loop (bool): Whether to loop playback
        autoplay (bool): Whether to start playing automatically
        subtitles (str, optional): Subtitle file path or URL
        end_time (int, optional): End playback time in seconds
        muted (bool): Whether to start muted
    """

def pdf(data, *, width=None, help=None):
    """
    Display PDF document with page navigation and zoom controls.

    Args:
        data: PDF data as bytes, file path, or URL
        width (int, optional): Display width in pixels
        help (str, optional): Tooltip text
    """

Utility Display Functions

Additional display functions for badges, help, and generic content.

def badge(label, *, icon=None, color="blue"):
    """
    Display small badge with text content.

    Args:
        label (str): Badge text content
        icon (str, optional): Optional icon or emoji
        color (str, optional): Badge color ("red", "orange", "yellow", "blue", "green", "violet", "gray", "grey", "primary")
    """

def help(obj):
    """
    Display help information about Python objects, functions, or modules.

    Args:
        obj: Python object to display help for
    """

def write(*args, unsafe_allow_html=False):
    """
    Universal display function that automatically formats various data types.

    Args:
        *args: Variable arguments of any type to display
        unsafe_allow_html (bool): Whether to allow HTML in strings
    """

def write_stream(stream, *, help=None):
    """
    Display streaming content with real-time updates.

    Args:
        stream: Iterable that yields content to display
        help (str, optional): Tooltip text
    """

def echo(code_location="above"):
    """
    Display the code that is being executed in the current context.

    Args:
        code_location (str): Where to show code ("above" or "below")
    """

Install with Tessl CLI

npx tessl i tessl/pypi-streamlit

docs

advanced-features.md

caching-performance.md

components-config.md

display-elements.md

index.md

input-widgets.md

layout-containers.md

navigation-pages.md

state-management.md

user-auth.md

tile.json