express.render.text
express.render.text(_fn=None, *, inline=False)Reactively render text.
When used in Shiny Express applications, this defaults to displaying the text as normal text on the web page. When used in Shiny Core applications, this should be paired with output_text in the UI.
Parameters
inline : bool = False-
(Express only). If
True, the result is displayed inline. (This argument is passed tooutput_text.)
Returns
A decorator for a function that returns a string.
Tip
The name of the decorated function (or @output(id=...)) should match the id of a output_text container (see output_text for example usage).
See Also
codeoutput_text
Examples
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
## file: app.py
from shiny.express import input, output_args, render, ui
ui.input_text("txt", "Enter the text to display below:", "delete me")
with ui.card():
ui.card_header(ui.code("ui.render_text"))
@render.text
def text1():
return input.txt()
with ui.card():
ui.card_header(ui.code("@output_args(placeholder=True)"))
@output_args(placeholder=True)
@render.code
def text2():
return input.txt()
with ui.card():
ui.card_header(ui.code("@output_args(placeholder=False)"))
@output_args(placeholder=False)
@render.code
def text3():
return input.txt()