eagle0504's picture
app updated
746d2f1
---
title: Chat elements
slug: /develop/api-reference/chat
---
# Chat elements
Streamlit provides a few commands to help you build conversational apps. These chat elements are designed to be used in conjunction with each other, but you can also use them separately.
`st.chat_message` lets you insert a chat message container into the app so you can display messages from the user or the app. Chat containers can contain other Streamlit elements, including charts, tables, text, and more. `st.chat_input` lets you display a chat input widget so the user can type in a message. Remember to check out `st.status` to display output from long-running processes and external API calls.
<TileContainer>
<RefCard href="/develop/api-reference/chat/st.chat_input">
<Image pure alt="screenshot" src="/images/api/chat_input.jpg" />
<h4>Chat input</h4>
Display a chat input widget.
```python
prompt = st.chat_input("Say something")
if prompt:
st.write(f"The user has sent: {prompt}")
```
</RefCard>
<RefCard href="/develop/api-reference/chat/st.chat_message">
<Image pure alt="screenshot" src="/images/api/chat_message.jpg" />
<h4>Chat message</h4>
Insert a chat message container.
```python
import numpy as np
with st.chat_message("user"):
st.write("Hello πŸ‘‹")
st.line_chart(np.random.randn(30, 3))
```
</RefCard>
<RefCard href="/develop/api-reference/status/st.status">
<Image pure alt="screenshot" src="/images/api/status.jpg" />
<h4>Status container</h4>
Display output of long-running tasks in a container.
```python
with st.status('Running'):
do_something_slow()
```
</RefCard>
<RefCard href="/develop/api-reference/write-magic/st.write_stream">
<h4>st.write_stream</h4>
Write generators or streams to the app with a typewriter effect.
```python
st.write_stream(my_generator)
st.write_stream(my_llm_stream)
```
</RefCard>
</TileContainer>