New features
-
Added a new
ui.MarkdownStream()
component for performantly streaming in chunks of markdown/html strings into the UI. This component is primarily useful for text-based generative AI where responses are received incrementally. (#1782) -
The
ui.Chat()
component now supports input suggestion links. This feature is useful for providing users with clickable suggestions that can be used to quickly input text into the chat. This can be done in 2 different ways (see #1845 for more details):- By adding a
.suggestion
CSS class to an HTML element (e.g.,<span class="suggestion">A suggestion</span>
) - Add a
data-suggestion
attribute to an HTML element, and set the value to the input suggestion text (e.g.,<span data-suggestion="Suggestion value">Suggestion link</span>
) - To auto-submit the suggestion when clicked by the user, include the
.submit
class or thedata-suggestion-submit="true"
attribute on the HTML element. Alternatively, use Cmd/Ctrl + click to auto-submit any suggestion or Alt/Opt + click to apply any suggestion to the chat input without submitting.
- By adding a
-
The
ui.Chat()
component also gains the following:- The
.on_user_submit()
decorator method now passes the user input to the decorated function. This makes it a bit easier to access the user input. See the new templates (mentioned below) for examples. (#1801) - The assistant icon is now configurable via
ui.chat_ui()
(or theui.Chat.ui()
method in Shiny Express) or for individual messages in the.append_message()
and.append_message_stream()
methods ofui.Chat()
. (#1853) - A new
latest_message_stream
property was added for an easy way to reactively read the stream's status, result, and also cancel an in progress stream. (#1846) - The
.append_message_stream()
method now returns thereactive.extended_task
instance that it launches. (#1846) - The
ui.Chat()
component's.update_user_input()
method gainssubmit
andfocus
options that allow you to submit the input on behalf of the user and to choose whether the input receives focus after the update. (#1851)
- The
-
shiny create
includes new and improvedui.Chat()
template options. Most of these templates leverage the new{chatlas}
package, our opinionated approach to interfacing with various LLM. (#1806) -
Client data values (e.g., url info, output sizes/styles, etc.) can now be accessed in the server-side Python code via
session.clientdata
. For example,session.clientdata.url_search()
reactively reads the URL search parameters. (#1832) -
Available
input
ids can now be listed viadir(input)
. This also works on the newsession.clientdata
object. (#1832) -
ui.input_text()
,ui.input_text_area()
,ui.input_numeric()
andui.input_password()
all gain anupdate_on
option.update_on="change"
is the default and previous behavior, where the input value updates immediately whenever the value changes. Withupdate_on="blur"
, the input value will update only when the text input loses focus or when the user presses Enter (or Cmd/Ctrl + Enter forui.input_text_area()
). (#1874) -
Added a new
.add_sass_layer_file()
method toui.Theme
that supports reading a Sass file with layer boundary comments, e.g./*-- scss:defaults --*/
. This format is supported by Quarto and makes it easier to store Sass rules and declarations that need to be woven into Shiny's Sass Bootstrap files. (#1790) -
Added a new
expect_max_height()
method to the Valuebox controllers to check the maximum height of a value box (#1816) -
shiny.pytest.create_app_fixture(app)
gained support for multiple app file paths when creating your test fixture. If multiple file paths are given, it will behave as a parameterized fixture value and execute the test for each app path. (#1869)
Breaking changes
-
The navbar-related style options of
ui.page_navbar()
andui.navset_bar()
have been consolidated into a singlenavbar_options
argument that pairs with a newui.navbar_options()
helper. Using the directposition
,bg
,inverse
,collapsible
, andunderline
arguments will continue to work with a deprecation message.Related to this change,
ui.navset_bar()
now defaults to usingunderline=True
so that it uses the same set of defaultui.navbar_options()
as the page variant. Inui.navbar_options()
,inverse
is replaced bytheme
, which takes values"light"
(dark text on a light background),"dark"
(light text on a dark background), or"auto"
(follow page settings). -
The Shiny Core component
shiny.ui.Chat()
no longer has a.ui()
method. This method
was never intended to be used in Shiny Core (in that case, useshiny.ui.chat_ui()
) to create the UI element. Note that theshiny.express.ui.Chat()
class still has a.ui()
method. (#1840)