A streamlit component, to make UI cards
Project description
st-card
Streamlit Component, for a UI card
authors - @gamcoh @Pernod Ricard
Installation
Install streamlit-card
with pip
pip install streamlit-card
usage, import the card
function from streamlit_card
from streamlit_card import card
hasClicked = card(
title="Hello World!",
text="Some description",
image="http://placekitten.com/200/300",
url="https://github.com/gamcoh/st-card"
)
You can also use a local image by doing this instead
import base64
with open(filepath, "rb") as f:
data = f.read()
encoded = base64.b64encode(data)
data = "data:image/png;base64," + encoded.decode("utf-8")
from streamlit_card import card
hasClicked = card(
title="Hello World!",
text="Some description",
image=data
url="https://github.com/gamcoh/st-card"
)
You can also create a card without an URL. That way you control the behavior when the user click on it. For instance:
from streamlit_card import card
hasClicked = card(
title="Hello World!",
text="Some description",
image="http://placekitten.com/200/300",
)
if hasClicked:
# do something
If you want, you could use a callback to handle the click like so:
from streamlit_card import card
hasClicked = card(
title="Hello World!",
text="Some description",
image="http://placekitten.com/200/300",
on_click=lambda: print("Clicked!")
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
streamlit-card-0.0.5.tar.gz
(670.9 kB
view details)
Built Distribution
File details
Details for the file streamlit-card-0.0.5.tar.gz
.
File metadata
- Download URL: streamlit-card-0.0.5.tar.gz
- Upload date:
- Size: 670.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6656d57396a7498b25d557f63d06c7336738612bff11681256693be3628c30f |
|
MD5 | 9cab5a8d15bd22c7306200c53935ed4f |
|
BLAKE2b-256 | e74d6832ab8c8fc9ad600f130047c5b3505a500a1c08dab113ea2dfaa6c73286 |
File details
Details for the file streamlit_card-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: streamlit_card-0.0.5-py3-none-any.whl
- Upload date:
- Size: 679.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccf13904b076d5d85618bb559cc1c1768874173f4f320e8e24a65b59f0d12342 |
|
MD5 | 7bfb16cc1bcd2022326e5fcdcb1c0f9f |
|
BLAKE2b-256 | e96ff436a7b91ee3a3e723e5fb25fe51e0ec366dc82a868d4187997ce979e765 |