I’m using streamlit’s the quill editor component to display the results of a transcription and to allow the users to edit the results of the transcription.
The problem is that sometimes the transcription is pretty big and the editor extends to the size of the content of the transcription which makes it huge and a pain to scroll all the way down the screen. Is there a way to control the max height of the editor and that the person can scroll inside the editor instead of the whole streamlit page?
import streamlit as st
from streamlit_quill import st_quill
st.markdown("""
<style>
.stElementContainer:has(> iframe) {
height: 300px;
overflow-y: scroll;
overflow-x: hidden;
}
</style>
""", unsafe_allow_html=True)
# Spawn a new Quill editor
content = st_quill(key='foobar')
# Display editor's content as you type
content
In the next release of the library you will be able to leverage the passed key as a CSS class like this:
import streamlit as st
from streamlit_quill import st_quill
st.markdown("""
<style>
.st-key-foobar {
height: 300px;
overflow-y: scroll;
overflow-x: hidden;
}
</style>
""", unsafe_allow_html=True)
# Spawn a new Quill editor
content = st_quill(key='foobar')
# Display editor's content as you type
content
Unfortunately, your example didn’t work for me. As you can see in the screenshot, the editor grows vertically when I add more text lines instead of reaching a max height and adding a scroll.
import streamlit as st
from streamlit_quill import st_quill
st.markdown("""
<style>
.stElementContainer:has(> iframe) {
height: 300px;
overflow-y: scroll;
overflow-x: hidden;
}
</style>
""", unsafe_allow_html=True)
# Spawn a new Quill editor
content = st_quill(key='foobar')
# Display editor's content as you type
content
That’s indeed really strange. I just tried it again and same result for me. I’m using streamlit 1.38 with python 3.12. Latest streamlit-quill version too and on Brave browser.
I tried in Chrome and Firefox too and same result.
Ahh in 1.38 the class name of the container is element-container, not stElementContainer (I have been testing with the version on the current develop branch), so the CSS part would be:
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.