Skip to content
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to Shiny for Python will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Deprecations

* `ui.output_text_verbatim()` is deprecated. Please use `ui.output_text()` if you want to create an output container for some text, or `ui.output_code()` if you want to create an output container for code (monospaced text). (#2097)

## [1.5.0] - 2025-09-11

### New features
Expand Down
2 changes: 1 addition & 1 deletion examples/brand/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
),
ui.card(
ui.card_header("Text Output"),
ui.output_text_verbatim("out_text1"),
ui.output_code("out_text1"),
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/ClientData/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
to reactively read the client data values from the browser.
"""
),
ui.output_text_verbatim("clientdatatext"),
ui.output_code("clientdatatext"),
ui.output_plot("myplot"),
)

Expand Down
8 changes: 4 additions & 4 deletions shiny/api-examples/Renderer/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
ui.h1("Capitalization renderer"),
ui.input_text("caption", "Caption:", "Data summary"),
"@render_upper: ",
ui.output_text_verbatim("upper", placeholder=True),
ui.output_code("upper", placeholder=True),
"@render_upper(): ",
ui.output_text_verbatim("upper_with_paren", placeholder=True),
ui.output_code("upper_with_paren", placeholder=True),
"@render_capitalize: ",
ui.output_text_verbatim("cap_upper", placeholder=True),
ui.output_code("cap_upper", placeholder=True),
"@render_capitalize(to='lower'): ",
ui.output_text_verbatim("cap_lower", placeholder=True),
ui.output_code("cap_lower", placeholder=True),
)


Expand Down
6 changes: 3 additions & 3 deletions shiny/api-examples/Renderer/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Literal, Optional

from shiny.render.renderer import Renderer, ValueFn
from shiny.ui import output_text_verbatim
from shiny.ui import output_code


class render_capitalize(Renderer[str]):
Expand All @@ -28,7 +28,7 @@ def auto_output_ui(self):
"""
Express UI for the renderer
"""
return output_text_verbatim(self.output_id, placeholder=True)
return output_code(self.output_id, placeholder=True)

def __init__(
self,
Expand Down Expand Up @@ -94,7 +94,7 @@ def auto_output_ui(self):
"""
Express UI for the renderer
"""
return output_text_verbatim(self.output_id, placeholder=True)
return output_code(self.output_id, placeholder=True)

async def transform(self, value: str) -> str:
"""
Expand Down
4 changes: 2 additions & 2 deletions shiny/api-examples/accordion/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def make_items():
ui.markdown("#### Accordion: (`multiple=False`)"),
# Provide an id to create a shiny input binding
ui.accordion(*make_items(), id="acc_single", multiple=False),
ui.output_text_verbatim("acc_single_val", placeholder=True),
ui.output_code("acc_single_val", placeholder=True),
ui.tags.br(),
ui.markdown("#### Accordion: (`multiple=True`)"),
ui.accordion(*make_items(), id="acc_multiple"),
ui.output_text_verbatim("acc_multiple_val", placeholder=True),
ui.output_code("acc_multiple_val", placeholder=True),
)


Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/accordion_panel/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Provide an id to create a shiny input binding
ui.accordion(*items, id="acc"),
ui.h4("Accordion:"),
ui.output_text_verbatim("acc_val", placeholder=True),
ui.output_code("acc_val", placeholder=True),
)


Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/calc/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ui.input_action_button("first", "Invalidate first (slow) computation"),
ui.input_action_button("second", "Invalidate second (fast) computation"),
),
ui.output_text_verbatim("result"),
ui.output_code("result"),
)
)

Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/input_numeric/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

app_ui = ui.page_fluid(
ui.input_numeric("obs", "Observations:", 10, min=1, max=100),
ui.output_text_verbatim("value"),
ui.output_code("value"),
)


Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/input_password/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
app_ui = ui.page_fluid(
ui.input_password("password", "Password:"),
ui.input_action_button("go", "Go"),
ui.output_text_verbatim("value"),
ui.output_code("value"),
)


Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/input_text/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

app_ui = ui.page_fluid(
ui.input_text("caption", "Caption:", "Data summary"),
ui.output_text_verbatim("value"),
ui.output_code("value"),
)


Expand Down
4 changes: 2 additions & 2 deletions shiny/api-examples/input_text_area/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"Caption:",
"Data summary\nwith\nmultiple\nlines",
),
ui.output_text_verbatim("value_regular", placeholder=True),
ui.output_code("value_regular", placeholder=True),
ui.input_text_area(
"caption_autoresize",
ui.markdown("Caption (w/ `autoresize=True`):"),
"Data summary\nwith\nmultiple\nlines",
autoresize=True,
),
ui.output_text_verbatim("value_autoresize", placeholder=True),
ui.output_code("value_autoresize", placeholder=True),
)


Expand Down
8 changes: 4 additions & 4 deletions shiny/api-examples/output_text/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
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.code("ui.output_code(placeholder=True)"),
ui.output_code("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),
ui.code("ui.output_code(placeholder=False)"),
ui.output_code("verb_no_placeholder", placeholder=False),
),
),
)
Expand Down
6 changes: 3 additions & 3 deletions shiny/api-examples/output_transformer/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ def render_capitalize(
ui.h1("Capitalization renderer"),
ui.input_text("caption", "Caption:", "Data summary"),
"Renderer called with out parentheses:",
ui.output_text_verbatim("no_parens"),
ui.output_code("no_parens"),
"To upper:",
ui.output_text_verbatim("to_upper"),
ui.output_code("to_upper"),
"To lower:",
ui.output_text_verbatim("to_lower"),
ui.output_code("to_lower"),
)


Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/popover/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
id="card_popover",
),
),
ui.output_text_verbatim("plot_txt", placeholder=True),
ui.output_code("plot_txt", placeholder=True),
),
)

Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/sidebar/app-core-dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def sidebar_dynamic_container():
position=input.position(),
),
ui.h2("Dynamic sidebar"),
ui.output_text_verbatim("state_dynamic"),
ui.output_code("state_dynamic"),
)

@render.text
Expand Down
8 changes: 4 additions & 4 deletions shiny/api-examples/sidebar/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
ui.card(
ui.layout_sidebar(
ui.sidebar("Left sidebar content", id="sidebar_left"),
ui.output_text_verbatim("state_left"),
ui.output_code("state_left"),
)
),
ui.card(
ui.layout_sidebar(
ui.sidebar("Right sidebar content", id="sidebar_right", position="right"),
ui.output_text_verbatim("state_right"),
ui.output_code("state_right"),
),
),
ui.card(
ui.layout_sidebar(
ui.sidebar("Closed sidebar content", id="sidebar_closed", open="closed"),
ui.output_text_verbatim("state_closed"),
ui.output_code("state_closed"),
)
),
ui.card(
ui.layout_sidebar(
ui.sidebar("Always sidebar content", id="sidebar_always", open="always"),
ui.output_text_verbatim("state_always"),
ui.output_code("state_always"),
)
),
)
Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/template/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
app_ui = ui.page_fluid(
ui.panel_title("Hello Shiny!"),
ui.input_slider("n", "N", 0, 100, 20),
ui.output_text_verbatim("txt"),
ui.output_code("txt"),
)


Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/theme/__purgecss.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
title="Parameters",
),
ui.h2("Output"),
ui.output_text_verbatim("txt"),
ui.output_code("txt"),
ui.markdown(filler_text),
title="Theme Example",
theme=my_theme,
Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/theme/app-core-local.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
title="Parameters",
),
ui.h2("Output"),
ui.output_text_verbatim("txt"),
ui.output_code("txt"),
ui.markdown(filler_text),
title="Theme Example",
theme=Path(__file__).parent / "css" / "shiny-theme-demo.css",
Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/theme/app-core-remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
title="Parameters",
),
ui.h2("Output"),
ui.output_text_verbatim("txt"),
ui.output_code("txt"),
ui.markdown(filler_text),
title="Theme Example",
theme="https://cdn.jsdelivr.net/npm/[email protected]/dist/sketchy/bootstrap.min.css",
Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/theme/app-core-shinyswatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
title="Parameters",
),
ui.h2("Output"),
ui.output_text_verbatim("txt"),
ui.output_code("txt"),
ui.markdown(filler_text),
title="Theme Example",
theme=shinyswatch.theme.slate(),
Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/theme/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
title="Parameters",
),
ui.h2("Output"),
ui.output_text_verbatim("txt"),
ui.output_code("txt"),
ui.markdown(filler_text),
title="Theme Example",
theme=my_theme,
Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/update_sidebar/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
ui.input_action_button("close_sidebar", label="Close sidebar", class_="me-3"),
ui.br(),
ui.br(),
ui.output_text_verbatim("state"),
ui.output_code("state"),
fillable=False,
)

Expand Down
2 changes: 1 addition & 1 deletion shiny/templates/app/01-basic-app/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
app_ui = ui.page_fluid(
ui.panel_title("Hello Shiny!"),
ui.input_slider("n", "N", 0, 100, 20),
ui.output_text_verbatim("txt"),
ui.output_code("txt"),
)


Expand Down
10 changes: 10 additions & 0 deletions shiny/ui/_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
"output_ui",
)

import warnings
from typing import Optional

from htmltools import Tag, TagAttrValue, TagFunction, css, div, tags

from .._deprecated import ShinyDeprecationWarning
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from .._deprecated import ShinyDeprecationWarning
from .._deprecated import warn_deprecated

from .._docstring import add_example, no_example
from ..module import resolve_id
from ..types import MISSING, MISSING_TYPE
Expand Down Expand Up @@ -346,6 +348,14 @@ def output_text_verbatim(id: str, placeholder: bool = False) -> Tag:
See :func:`~shiny.ui.output_text`
"""

warnings.warn(
"`ui.output_text_verbatim()` is deprecated. "
"Please use `ui.output_text()` if you want to create an output container for some text, "
"or `ui.output_code()` if you want to create an output container for code (monospaced text).",
category=ShinyDeprecationWarning,
stacklevel=2,
)
Copy link
Collaborator

@schloerke schloerke Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
)
warn_deprecated(
"`ui.output_text_verbatim()` was deprecated in v1.6.0."
"Please use `ui.output_text()` / `@render.text` to create an output container for plain text "
"or `ui.output_code()` / `@render.code` to create an output container for monospaced text."
)


cls = "shiny-text-output" + (" noplaceholder" if not placeholder else "")
return tags.pre(id=resolve_id(id), class_=cls)

Expand Down
2 changes: 2 additions & 0 deletions tests/playwright/examples/example_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def get_apps(path: str) -> typing.List[str]:
"FutureWarning: use_inf_as_na option is deprecated",
"pd.option_context('mode.use_inf_as_na", # continutation of line above,
"RuntimeWarning: invalid value encountered in dot", # some groups didn't have enough data points to create a meaningful line
# output_text_verbatim deprecation: https://github.com/posit-dev/py-shiny/pull/2097
"ShinyDeprecationWarning: `ui.output_text_verbatim()` is deprecated.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# output_text_verbatim deprecation: https://github.com/posit-dev/py-shiny/pull/2097
"ShinyDeprecationWarning: `ui.output_text_verbatim()` is deprecated.",

]
app_allow_js_errors: typing.Dict[str, typing.List[str]] = {
"examples/brownian": ["Failed to acquire camera feed:"],
Expand Down
2 changes: 1 addition & 1 deletion tests/playwright/shiny/async/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def calc(value: str) -> str:
"value", "Value to sha256sum", value="The quick brown fox", rows=5, width="100%"
),
ui.p(ui.input_action_button("go", "Calculate"), class_="mb-3"),
ui.output_text_verbatim("hash_output"),
ui.output_code("hash_output"),
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def slider_with_reset_ui(
timezone="UTC",
time_format="%H:%M:%S",
),
ui.output_text_verbatim("txt"),
ui.output_code("txt"),
ui.div(ui.input_action_button("reset", label)),
)

Expand Down
8 changes: 4 additions & 4 deletions tests/playwright/shiny/bugs/0696-resolve-id/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ def ui_navs(label: str) -> list[ui._navs.NavPanel]:
),
ui.layout_column_wrap(
*[
ui.output_text_verbatim(f"status_x_{x_input_key}", placeholder=True)
ui.output_code(f"status_x_{x_input_key}", placeholder=True)
for x_input_key in x_input_keys
],
*[
ui.output_text_verbatim(f"status_{input_key}", placeholder=True)
ui.output_code(f"status_{input_key}", placeholder=True)
for input_key in input_keys
],
width=1 / 2,
Expand Down Expand Up @@ -200,7 +200,7 @@ def ui_navs(label: str) -> list[ui._navs.NavPanel]:
"Image (Changes w/ `input.radio_buttons()`)",
ui.output_image("out_image", height="180px"),
),
("Text Verbatim", ui.output_text_verbatim("out_text_verbatim")),
("Text Verbatim", ui.output_code("out_text_verbatim")),
("Text", ui.output_text("out_text")),
("UI", ui.output_ui("out_ui")),
)
Expand Down Expand Up @@ -371,7 +371,7 @@ def preprocess_file(x: Any) -> str:
width=1 / 3,
),
# ui.h3("Inputs that are not in a module:"),
# ui.output_text_verbatim("not_modules", placeholder=True),
# ui.output_code("not_modules", placeholder=True),
)


Expand Down
Loading
Loading