Skip to main content

A simple component that returns the dimensions of the container where it is rendered.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_container_width-1.0.3.tar.gz (499.2 kB view details)

Uploaded Source

File details

Details for the file streamlit_container_width-1.0.3.tar.gz.

File metadata

File hashes

Hashes for streamlit_container_width-1.0.3.tar.gz
Algorithm Hash digest
SHA256 abab06ebedc229021f7e2076e5264699729900b7915aa2aac1c4f362d172e3be
MD5 b4fc732e7e2345d9aa7778c04a2dd172
BLAKE2b-256 1528d71b2b178ac049c447d644dfc02f64da81474bdf0140b082cea1e91e28b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page