Blossom UI

Rating

Star rating component with decimal values, review count, interactive mode and a review card.

How to use it

Run npx @blossomui/react add rating, or copy src/components/UI/Rating/Rating.tsx into your React project and import it.

import { Rating, Review } from './components/ui/Rating'

Props

RatingLabels

PropTypeDescription
stars (required)(value: number, max: number) => stringAccessible name of the stars, for example "3.5 out of 5 stars".
star (required)(star: number) => stringAccessible name of the button of one star.
outOf (required)(value: number, max: number) => stringText shown with `showValue`.
reviews (required)(count: number) => stringText shown after the stars with `reviews`.

RatingProps

PropTypeDescription
labelsPartial<RatingLabels>Texts of the component. Pass only the ones you want to change, for example to translate it.
colorstringColor of the filled stars: any CSS color. Gold by default.
value (required)numberCurrent rating, decimals are supported (3.67).
maxnumber
sizenumberStar size in pixels.
onChange(value: number) => voidMakes the stars clickable and called with the chosen value.
showValuebooleanShow "3.67 out of 5".
reviewsnumberNumber of reviews, shown after the stars.

ReviewProps

PropTypeDescription
author (required)string
rating (required)number
date (required)string
children (required)string

Getting started

  • Introduction
  • Installation
  • Changelog

Customization

  • Colors
  • Brand color
  • Texts and translation

Components

  • Accordion
  • Alert dialog
  • Alerts
  • Avatar
  • Badges
  • Banner
  • Breadcrumb
  • Buttons
  • Calendar
  • Cards
  • Carousel
  • Charts
  • Chip input
  • Collapsible
  • Color picker
  • Combobox
  • Command palette
  • Context menu
  • Copy button
  • Date picker
  • Drawer
  • Dropdown
  • Empty state
  • File upload
  • Footer
  • Forms
  • Hover card
  • Jumbotron
  • KBD
  • Menubar
  • Modal
  • Navbar
  • Navigation menu
  • Number input
  • OTP input
  • Pagination
  • Popover
  • Pricing
  • Progress
  • Rating
  • Resizable panels
  • Scroll area
  • Segmented control
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Spinners
  • Stats
  • Stepper
  • Survey
  • Table
  • Tabs
  • Time picker
  • Timeline
  • Timer button
  • Toasts
  • Tooltip
  • Transfer list
  • Tree