ui.output_text

ui.output_text(id, inline=False, container=None)

Create a output container for some text.

Parameters

id: str

An output id.

inline: bool = False

If True, the result is displayed inline.

container: Optional[TagFunction] = None

A Callable that returns the output container.

Returns

Type Description
Tag A UI element

Note

Text is HTML-escaped prior to rendering.

See Also

Examples

#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400

## file: app.py
from shiny import App, Inputs, Outputs, Session, render, ui

app_ui = ui.page_fluid(
    ui.input_text("txt", "Enter the text to display below:", "delete me"),
    ui.row(
        ui.column(6, ui.code("ui.output_text()"), ui.output_text("text")),
        ui.column(
            6,
            ui.code("ui.output_text_verbatim(placeholder=True)"),
            ui.output_text_verbatim("verb", placeholder=True),
        ),
    ),
    ui.row(
        ui.column(6),
        ui.column(
            6,
            ui.code("ui.output_text_verbatim(placeholder=False)"),
            ui.output_text_verbatim("verb_no_placeholder", placeholder=False),
        ),
    ),
)


def server(input: Inputs, output: Outputs, session: Session):
    @render.text
    def text():
        return input.txt()

    @render.text
    def verb():
        return input.txt()

    @render.text
    def verb_no_placeholder():
        return input.txt()


app = App(app_ui, server)