render.express
render.express(self,
=None,
_fn*,
=False,
inline=None,
container=False,
fill=False,
fillable**kwargs,
)
Reactively render HTML content with output captured as in Shiny Express
This is similar to ui, except that ui uses the return value from the the decorated function, whereas this function works like Shiny Express: as it executes each line of the decorated function, it calls :func:~sys.displayhook()
on the result. This has the effect of "capturing" the output of each line.
This decorator can be thought of as a combination of ui (for rendering and sending the dynamic UI to the client), and ~shiny.express.expressify
(for capturing the output of each line).
Returns
:
-
A decorator for a function that returns
None
.
See Also
Examples
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
## file: app.py
from shiny import App, render, ui
app_ui = ui.page_fluid(
ui.input_text("name", "Name", "Socrates"),
ui.input_text("years", "Years", "470-399 BC"),
ui.output_ui("person"),
)
def server(input, output, session):
@render.express
def person():
from shiny.express import ui
with ui.card(class_="mt-3"):
ui.h3(input.name())
input.years()
app = App(app_ui, server)