chat_greeting
chat_greeting(content, *, persistent=MISSING, dismissible=DEPRECATED)Create a greeting for a chat UI.
A greeting is a welcome message displayed at the top of the chat before any conversation messages. It can be static (set via :func:~shinychat.chat_ui) or dynamic (set via :meth:~shinychat.Chat.set_greeting).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| content | Union[str, HTML, Tag, TagList, 'AsyncIterable[str]'] | The greeting content. Can be a markdown string, :class:~htmltools.HTML, :class:~htmltools.Tag, :class:~htmltools.TagList, or an :class:~typing.AsyncIterable of strings (streaming, only valid via :meth:~shinychat.Chat.set_greeting). |
required |
| persistent | 'bool | MISSING_TYPE' | Whether the greeting stays visible after the user sends a message. When False (the default), the greeting is hidden once the user sends their first message. Set to True to keep the greeting visible throughout the conversation, which is useful for persistent instructions or navigation. |
MISSING |
Examples
Basic greeting:
from shinychat import chat_greeting
chat_greeting("## Welcome!\n\nHow can I help you today?")Persistent greeting that stays visible:
chat_greeting("Please select a topic to get started.", persistent=True)Greeting with suggestion cards (uses <span class="suggestion">):
chat_greeting(
"## Welcome!\n\n"
'<span class="suggestion">Summarize this dataset</span>\n'
'<span class="suggestion">Show me recent trends</span>'
)See Also
: Set a static greeting in the UI definition. : Set or stream a greeting from the server.