Skip to content

edball10/streamlit-container-width

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Streamlit - Container - Width

A simple streamlit component that returns the dimensions of the container where it is rendered. This may be used to format other components that require the dimensions of the container.

Notes and Limitations

If multiple st_container_width components will be used in the app, each component must be given a unique key value. Otherwise, the key argument is not required.

The current version only provides the width of the container in pixels.

Installation

pip install streamlit-container-width

Example

import streamlit as st
from streamlit_container_width import st_container_width

st.set_page_config(layout="wide")

st.title("Main Dimensions")
st.write(st_container_width(key="main"))

with st.sidebar:
    st.title("Sidebar Dimensions")
    st.write(st_container_width(key="sidebar"))

demo-app

About

A simple streamlit component that returns the width of the container each time it renders or changes.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Python 49.4%
  • TypeScript 29.0%
  • HTML 21.6%