render.code

render.code(self, _fn=None, *, placeholder=True)

Reactively render text as code (monospaced).

When used in Shiny Express applications, this defaults to displaying the text in a monospace font in a code block. When used in Shiny Core applications, this should be paired with output_code in the UI.

Parameters

placeholder: bool = True

(Express only) If the output is empty or None, should an empty rectangle be displayed to serve as a placeholder? This does not affect behavior when the output is nonempty. (This argument is passed to output_code.)

Returns

Type Description
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_code container (see output_code for example usage).

See Also