Saltar al contenido
El Muestrario

componente · @solu30/ui-kit/input

StarRating

Puntuación de cinco estrellas interactiva, con etiqueta de categoría configurable por idioma.

4 sitios de import en 3 de 15 verticales — un archivo que la importa cuenta una vez, monte una instancia o veinte.

  • TheCharterPanel
  • cmp-packages
  • easycharter

El componente, montado

Cargando el componente del paquete instalado…

Cómo se usa

import { StarRating } from '@solu30/ui-kit/input'

Props

8 props declaradas en los tipos de la versión instalada.
PropRequeridaTipoQué hace
valuesínumberRating value 1-5
onChangeopcional(value: number) => voidCallback when a star is clicked (omit for readonly)
readonlyopcionalbooleanWhether the rating is readonly
sizeopcionalStarRatingSizeStar size
showLabelopcionalbooleanWhether to show the text label below the stars
getCategoryLabelopcional(stars: number) => stringCustom function to get the category label for a given rating
starLabelopcional{ singular: string; plural: string; }Label suffix for the star count (e.g. "Star" / "Stars")
classNameopcionalstringAdditional CSS class

Ejemplo del paquete

<StarRating
  value={rating}
  onChange={setRating}
  getCategoryLabel={(n) => t(`stars.${n}`)}
  starLabel={{ singular: 'Star', plural: 'Stars' }}
/>

Del @example del JSDoc de @solu30/ui-kit, sin editar: son 65 de los 541 símbolos. La sangría y los renglones en blanco son los del paquete.