Skip to main content

A streamlit component, to make UI cards

Project description

st-card

Streamlit Component, for a UI card

authors - @gamcoh @Pernod Ricard

image

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


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)

Uploaded Source

Built Distribution

streamlit_card-0.0.5-py3-none-any.whl (679.8 kB view details)

Uploaded Python 3

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

Hashes for streamlit-card-0.0.5.tar.gz
Algorithm Hash digest
SHA256 c6656d57396a7498b25d557f63d06c7336738612bff11681256693be3628c30f
MD5 9cab5a8d15bd22c7306200c53935ed4f
BLAKE2b-256 e74d6832ab8c8fc9ad600f130047c5b3505a500a1c08dab113ea2dfaa6c73286

See more details on using hashes here.

File details

Details for the file streamlit_card-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_card-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ccf13904b076d5d85618bb559cc1c1768874173f4f320e8e24a65b59f0d12342
MD5 7bfb16cc1bcd2022326e5fcdcb1c0f9f
BLAKE2b-256 e96ff436a7b91ee3a3e723e5fb25fe51e0ec366dc82a868d4187997ce979e765

See more details on using hashes here.

Supported by

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