streamlit-float 
Fix the vertical position of Streamlit containers relative to viewport instead of page
Installation
Install streamlit-float with pip:
pip install streamlit-float
Usage
This package provides two ways to float a container. The first is to call the float method of a container:
import streamlit as st
from streamlit_float import *
# initialize float feature/capability
float_init()
col1, col2 = st.columns(2)
# Fix/float the whole column
col1.write("This entire column is fixed/floating")
col1.float()
with col2:
container = st.container()
# Fix/float a single container inside
container.write("This text is in a container that is fixed")
container.float()
Alternatively, you can use the float_parent method:
import streamlit as st
from streamlit_float import *
# initialize float feature/capability
float_init()
col1, col2 = st.columns(2)
# Fix/float the whole column
with col1:
st.write("This entire column is fixed/floating")
float_parent()
with col2:
container = st.container()
# Fix/float a single container inside
with container:
st.write("This text is in a container that is fixed")
float_parent()
Note that the float feature does not work well with expander and tabs containers. Also, it is recommended to call the float methods on a container after all the content has been added to it.
If instead you would like to float/fix a container that is constructed in html markup and added using Streamlits markdown method (with unsafe_allow_html=True), make sure to add 'floating' to the containers classlist.
st.markdown('''<div class="floating">..content..</div>''', unsafe_allow_html=True)
License
This project is licensed under the MIT License
Metadata
Release files for streamlit-float 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| streamlit_float-0.4.0.tar.gz | 16.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| streamlit_float-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.8 kB
Release files / streamlit_float-0.4.0.tar.gz
| Download URL | streamlit_float-0.4.0.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef1114d3b3b6356ae9175aaa89626bcf62bee476ec40a6e94e3a209accbdb82c
|
|
BLAKE2b-256 checksum How to use checksums |
909c2b01908b1821320901a0e30758b7eb9661a87983fecce11f5e39e03f120c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / streamlit_float-0.4.0-py3-none-any.whl
| Download URL | streamlit_float-0.4.0-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3818cefe0127dd4517f39f7e9cc84acdb387e8477db3656f8e1ab8c68aa34d20
|
|
BLAKE2b-256 checksum How to use checksums |
d9e0b951225656f9e22a435faa7b16ab193e1114684e45b68dbb36bd84c8e1b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|