Skip to content

Rating

uitemplate

Rating: renders a row of star glyphs for a 1-to-N rating

Installation

$ bunx termuijs add rating

Copies the source into src/components/rating/ and installs @termuijs/core, @termuijs/widgets.

Usage

ts
import { Rating } from '@termuijs/ui'
ts
new Rating(style: Partial<Style> = {}, opts: RatingOptions = {})

API Reference

Rating

PropTypeRequiredDescription
maxnumberoptionalTotal number of stars
valuenumberoptionalInitial rating
filledCharstringoptionalFilled star character
emptyCharstringoptionalEmpty star character
filledColorColoroptionalColor for filled stars
onSelect(value: number) => voidoptionalCallback when the user confirms a rating via enter
#template#rating