streamlit-float


Namestreamlit-float JSON
Version 0.3.5 PyPI version JSON
download
home_pagehttps://github.com/bouzidanas/streamlit-float
SummaryFix Streamlit containers relative to viewport instead of page
upload_time2024-06-08 15:33:12
maintainerNone
docs_urlNone
authorAnas Bouzid
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            streamlit-float [![PyPi - Downloads](https://img.shields.io/pypi/dm/streamlit-float)](https://pypi.org/project/streamlit-float/#files)
============

Fix the vertical position of Streamlit containers relative to viewport instead of page

## Installation
Install streamlit-float with pip:
```bash
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:

```python
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:

```python
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.

```python
st.markdown('''<div class="floating">..content..</div>''', unsafe_allow_html=True)
```

## License
This project is licensed under the [MIT License](LICENSE.txt)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bouzidanas/streamlit-float",
    "name": "streamlit-float",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Anas Bouzid",
    "author_email": "anasbouzid@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/49/e9/133e3c5f42dd0db83263c1c1c67364390c68371fa4fbc945b2df867715c5/streamlit-float-0.3.5.tar.gz",
    "platform": null,
    "description": "streamlit-float [![PyPi - Downloads](https://img.shields.io/pypi/dm/streamlit-float)](https://pypi.org/project/streamlit-float/#files)\n============\n\nFix the vertical position of Streamlit containers relative to viewport instead of page\n\n## Installation\nInstall streamlit-float with pip:\n```bash\npip install streamlit-float\n```\n\n## Usage\nThis package provides two ways to float a container. The first is to call the `float` method of a container:\n\n```python\nimport streamlit as st\nfrom streamlit_float import *\n\n# initialize float feature/capability\nfloat_init()\n\ncol1, col2 = st.columns(2)\n\n# Fix/float the whole column\ncol1.write(\"This entire column is fixed/floating\")\ncol1.float()\n\nwith col2:\n    container = st.container()\n    # Fix/float a single container inside\n    container.write(\"This text is in a container that is fixed\")\n    container.float()\n\n```\n\nAlternatively, you can use the `float_parent` method:\n\n```python\nimport streamlit as st\nfrom streamlit_float import *\n\n# initialize float feature/capability\nfloat_init()\n\ncol1, col2 = st.columns(2)\n\n# Fix/float the whole column\nwith col1:\n    st.write(\"This entire column is fixed/floating\")\n    float_parent()\n\nwith col2:\n    container = st.container()\n    # Fix/float a single container inside\n    with container:\n        st.write(\"This text is in a container that is fixed\")\n        float_parent()\n\n```\n\nNote 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.\n\nIf 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.\n\n```python\nst.markdown('''<div class=\"floating\">..content..</div>''', unsafe_allow_html=True)\n```\n\n## License\nThis project is licensed under the [MIT License](LICENSE.txt)\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Fix Streamlit containers relative to viewport instead of page",
    "version": "0.3.5",
    "project_urls": {
        "Homepage": "https://github.com/bouzidanas/streamlit-float"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7445c4ff347f85e575de70cf225f7ec57db04d80a6d693b8afde2575a1183dea",
                "md5": "7ecb83cd101ca6dd24e25cee3485e5b3",
                "sha256": "fa329f37b6e9280fa06519fa0ca89e1d5605b38240f49395700312e7a679e47e"
            },
            "downloads": -1,
            "filename": "streamlit_float-0.3.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7ecb83cd101ca6dd24e25cee3485e5b3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 11980,
            "upload_time": "2024-06-08T15:33:11",
            "upload_time_iso_8601": "2024-06-08T15:33:11.021886Z",
            "url": "https://files.pythonhosted.org/packages/74/45/c4ff347f85e575de70cf225f7ec57db04d80a6d693b8afde2575a1183dea/streamlit_float-0.3.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49e9133e3c5f42dd0db83263c1c1c67364390c68371fa4fbc945b2df867715c5",
                "md5": "5c867afac8736c12ce0e0b6f62cba671",
                "sha256": "a7cf12214e97bb99ed7cc25470af68974e5a51f65a956f31acf7b840d00cd153"
            },
            "downloads": -1,
            "filename": "streamlit-float-0.3.5.tar.gz",
            "has_sig": false,
            "md5_digest": "5c867afac8736c12ce0e0b6f62cba671",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 13211,
            "upload_time": "2024-06-08T15:33:12",
            "upload_time_iso_8601": "2024-06-08T15:33:12.301725Z",
            "url": "https://files.pythonhosted.org/packages/49/e9/133e3c5f42dd0db83263c1c1c67364390c68371fa4fbc945b2df867715c5/streamlit-float-0.3.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-08 15:33:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bouzidanas",
    "github_project": "streamlit-float",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "streamlit-float"
}
        
Elapsed time: 0.61131s