https://github.com/avsolatorio/streamlit-dimensions
A simple streamlit component that returns the dimensions of the container where it is rendered.
https://github.com/avsolatorio/streamlit-dimensions
streamlit
Last synced: about 1 year ago
JSON representation
A simple streamlit component that returns the dimensions of the container where it is rendered.
- Host: GitHub
- URL: https://github.com/avsolatorio/streamlit-dimensions
- Owner: avsolatorio
- License: mit
- Created: 2022-03-18T01:27:13.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-18T07:47:05.000Z (over 4 years ago)
- Last Synced: 2025-03-26T23:04:35.478Z (about 1 year ago)
- Topics: streamlit
- Language: Python
- Homepage:
- Size: 383 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Streamlit - Dimensions
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_dimensions` 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
```shell script
pip install streamlit-dimensions
```
## Example
```python
import streamlit as st
from streamlit_dimensions import st_dimensions
st.set_page_config(layout="wide")
st.title("Main Dimensions")
st.write(st_dimensions(key="main"))
with st.sidebar:
st.title("Sidebar Dimensions")
st.write(st_dimensions(key="sidebar"))
```
