A custom Streamlit component for analytics cards
Project description
streamlit-analytics-cards
A project to create custom Streamlit components using React and TypeScript for analytics and insights.
View a demo: 💾 View it on PyPI: 👾
Using the component
Prerequisites
Installation
pip install streamlit-analytics-cards
Implementation
from streamlit_analytics_cards import card as stac
# Render the component in your Streamlit app
stac(
template="CardOne",
title="Attrition Diversity",
subtitle="Female Attrition",
main_value="4.7%",
secondary_value="52",
delta="Y/Y 5.1%, -0.4%",
chart_data=df["Number of Exits"].tolist(),
x_axis_label=df.columns[0],
color_scheme={"background": "#FFFFFF", "text": "#000000"},
key="card_1",
)
For developers
Prerequisites
Before you start, ensure you have the following installed on your system:
Installation
-
Clone the repository:
git clone https://github.com/natxc/streamlit-analytics-cards.git cd streamlit-analytics-cards
-
Set up the Python environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Install frontend dependencies: Navigate to the
frontend/folder and install the required Node.js packages:cd frontend npm install
Development
Run the Frontend
Start the development server for the React app:
npm start
This will start a local development server at http://localhost:3000.
Run the Streamlit
In the root directory, start the Streamlit app:
streamlit run streamlit_app/app.py
Production Build
-
Build the Frontend: Navigate to the
frontend/folder and run:npm run build
This will create a production-ready build in the
frontend/builddirectory. -
Run Streamlit in Production Mode: Ensure
_RELEASEis set toTruein the__init__.pyfile:_RELEASE = True
Then start the Streamlit app:
streamlit run streamlit_app/app.py
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlit_analytics_cards-0.0.1.tar.gz.
File metadata
- Download URL: streamlit_analytics_cards-0.0.1.tar.gz
- Upload date:
- Size: 562.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fc3be8a8bced3c550748b936f1eb005b5d2f46e30fe55aa7b22240342c3d338
|
|
| MD5 |
b32f5b732cf64a7b7dbc00900b8e3bb2
|
|
| BLAKE2b-256 |
a1e206d1b26d360e5eac91f99192c6d9c720a7a8dfb27f7afdc7985210efd6d2
|
File details
Details for the file streamlit_analytics_cards-0.0.1-py3-none-any.whl.
File metadata
- Download URL: streamlit_analytics_cards-0.0.1-py3-none-any.whl
- Upload date:
- Size: 566.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fab31a411297387dd3ed65d50a336a543a0cf4820c80adb84e4f1cf3790b1089
|
|
| MD5 |
4ce44286b03055d27b2b70c0c75d3ebd
|
|
| BLAKE2b-256 |
656049c372930233b3456d0cd43ea14e3a74891f9151ed124d74dd3a12866db2
|