survey_chat_ui() is the survey chat alone, for a sidebar, a card, or a
tab of a larger app. Pair it with survey_server() with the same id.
The survey starts when the chat first shows on the screen, so a closed
sidebar does not start a session.
Usage
survey_chat_ui(
id,
drawer = FALSE,
progress = TRUE,
placeholder = "Type your answer...",
icon_assistant = NULL
)Arguments
- id
The module id. It must be the same in the UI and the server.
- drawer
FALSEfor no drawer, or ashinychat::chat_drawer()for a panel beside the chat. Thedrawerfunction ofsurvey_server()fills it with the answers.- progress
Whether to show the progress cue below the chat input.
- placeholder
The placeholder text of the chat input.
- icon_assistant
The icon next to the survey messages, or
NULLfor no icon. Seeshinychat::chat_ui().
See also
The "icecream" example of run_example() puts the chat in
the sidebar of a shop page.
Examples
if (FALSE) { # interactive() && rlang::is_installed("RSQLite")
library(shiny)
library(bslib)
ui <- page_sidebar(
sidebar = sidebar(
survey_chat_ui(
"survey",
drawer = shinychat::chat_drawer(title = "Answers", open = FALSE)
),
position = "right",
fillable = TRUE,
width = 440
),
"The main page content"
)
}
