Overview
Streamlit 1.20, released on January 20, 2023, introduces st.data_editor for interactive data editing and st.chat_message for chat interfaces.
Main Features
st.data_editor
The st.data_editor component lets you edit a DataFrame directly in the browser with type validation and Python-side change tracking.
python
import streamlit as st
import pandas as pd
df = pd.DataFrame({
'name': ['Alice', 'Bob', 'Charlie'],
'score': [85, 92, 78],
'active': [True, True, False],
})
# Editable table in the browser
edited = st.data_editor(df, num_rows='dynamic')
st.write('Modified data:', edited)
st.chat_message
The st.chat_message component lets you build chat interfaces with styled message bubbles for user and assistant.
python
import streamlit as st
with st.chat_message('user'):
st.write('Hello, how are you?')
with st.chat_message('assistant'):
st.write('I am doing great! How can I help you?')
# Chat input field
prompt = st.chat_input('Your message')
if prompt:
with st.chat_message('user'):
st.write(prompt)
