display
Display a Python object in the current component.
def display(*objs, **kwargs):
...
Supported objects
Any object that can be displayed in the Jupyter notebook can be displayed in Solara as well. This means that plotly, pandas, vaex and other libraries that have a display function will work out of the box in Solara.
However, if you require callback functions, use the specific Solara components, e.g.:
import solara
import pandas as pd
import plotly.express as px
df = px.data.gapminder()
fig = px.scatter(df, x="gdpPercap", y="lifeExp")
button = solara.Button("Click me")
@solara.component
def Page():
# You can use solara.display directly
solara.display(fig)
# Or use the IPython display function, which is in the global scope
# in Jupyter and Solara
display(df)
with solara.Card("Some card"):
# you can use display to add existing elements to the parent's
# children
display(button)