Skip to main content

Streamlit Star Rating Component

This streamlit component adds a star selector to Streamlit Apps.

It implements the Baseui Rating implementation: https://baseweb.design/components/rating/

Installation

$ pip install st-star-rating

Usage

Import the Component

$ from streamlit_star_rating import st_star_rating

$ stars = st_star_rating("Please rate you experience", maxValue=5, defaultValue=3, key="rating")

maxValue : Determines how many Stars will be shown defaultValue: Amount of preselected Stars

Choose between a dark and light theme

$ stars = st_star_rating(label = "Please rate you experience", maxValue = 5, defaultValue = 3, key = "rating", dark_theme = True )

Read-Only Mode

Users can not change the amout of selected stars

st_star_rating(label = "Please rate you experience", maxValue = 5, defaultValue = 3, key = "rating", read_only = True )

Emojis instead of Stars

Note: The maximum value is limited to 5 when using emojis instead of stars.

st_star_rating(label = "Please rate you experience", maxValue = 5, defaultValue = 3, key = "rating", emoticons = True )

Update 2023-06

It is possible to add a reset button to the component. The reset button will reset the rating to the default value.

st_star_rating(label = "Please rate you experience", maxValue = 5, defaultValue = 3, key = "rating", reset_button = True )

Furthermore, the label of the button can be determined by setting the resetLabel parameter. Note: HTML tags will be interpreted.

st_star_rating(label = "Please rate you experience", maxValue = 5, defaultValue = 3, key = "rating", reset_button = True, resetLabel = "Reset" )

Additionally it is possible to provide custom CSS to the component. The CSS can be provided as string and will be rendered in <style> tags.

st_star_rating(label = "Please rate you experience", maxValue = 5, defaultValue = 3, key = "rating", reset_button = True, resetLabel = "Reset", customCSS = "div {background-color: red;}" )

Update 2023-10

Added an on_click parameter. Using this parameter enables user to execute a python function that gets executed once the value component gets clicked.

Release files for st-star-rating 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for st-star-rating 0.0.6
File Interpreter ABI Platform
st_star_rating-0.0.6-py3-none-any.whl Python 3 none any Details

Release files / st_star_rating-0.0.6-py3-none-any.whl

Download URL st_star_rating-0.0.6-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
238e31d531df34a8e15eebb348cbed953c9c1689889233457c8e67846b073d79
BLAKE2b-256 checksum
How to use checksums
4d080202a7f9383f32ddc55f1b1acd62a30998cd5fb7349bc44d2c8cb53b7038
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.0.6 This release

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page