Richly display objects

marimo has built-in rich representations of many objects, including native Python objects like lists and dicts as well as marimo objects like UI elements and libraries, including matplotlib, seaborn, Plotly, altair pandas, and more. These rich representations are displayed for the last expression of a cell, or when using mo.output.append.

You can register rich displays with marimo for your own objects.

Option 1: Implement a _mime_ method

When displaying an object, marimo’s media viewer checks for the presence of a method called _mime_. This method should take no arguments and return a tuple of two strings, the mime type and data to be displayed.

Examples.

Option 2: Add a formatter to the marimo repo

When you don’t have the ability to implement a _mime_ method on the type you want displayed, you can register custom formatters with marimo.

We welcome contributors to add formatters to the marimo codebase. Look at our codebase for examples, then open a pull request.

AnyWidget