Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bpk-component-star-rating

Package Overview
Dependencies
Maintainers
6
Versions
434
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bpk-component-star-rating

Backpack rating star component.

  • 4.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
6
Weekly downloads
 
Created
Source

bpk-component-star-rating

Backpack rating star component.

Installation

npm install bpk-component-star-rating --save-dev

Usage

import React from 'react';
import BpkStarRating, {
  BpkStar,
  STAR_TYPES,
  BpkInteractiveStarRating,
  withInteractiveStarRatingState
} from 'bpk-component-star-rating';

const InteractiveStarRating = withInteractiveStarRatingState(BpkInteractiveStarRating);

export default () => (
  <div>
    <BpkStar
      type={STAR_TYPES.HALF}
    />
    <BpkStarRating
      rating={3.5}
      large
      ratingLabel={(rating, maxRating) => `Rated ${rating} out of ${maxRating} stars`}
    />
    <InteractiveStarRating
      id="large-star-rating"
      onRatingSelect={(rating) => console.log(rating)}
      getStarLabel={(rating, maxRating) => `${rating} out of ${maxRating} stars`}
    />
  </div>
);

Props

BpkStarRating

PropertyPropTypeRequiredDefault Value
ratingLabeloneOfType(string, func)true-
classNamestringfalsenull
largeboolfalsefalse
maxRatingnumberfalse5
ratingnumberfalse0
roundingoneOf(ROUNDING_TYPES)falseROUNDING_TYPES.down

BpkStar

PropertyPropTypeRequiredDefault Value
typeoneOf(STAR_TYPES)true-
classNamestringfalsenull
largeboolfalsefalse

withInteractiveStarRatingState()

PropertyPropTypeRequiredDefault Value
onRatingSelectfuncfalse() => null

BpkInteractiveStarRating

PropertyPropTypeRequiredDefault Value
getStarLabelfunctrue-
idstringtrue-
classNamestringfalsenull
hoverRatingnumberfalse0
largeboolfalsefalse
maxRatingnumberfalse5
onMouseLeavefuncfalse() => null
onRatingHoverfuncfalse() => null
onRatingSelectfuncfalse() => null
ratingnumberfalse0

BpkInteractiveStar

PropertyPropTypeRequiredDefault Value
labelbooltrue-
namebooltrue-
typeoneOf(STAR_TYPES)true-
valuenumbertrue-
onClickfunctrue-
onMouseEnterfunctrue-
selectedboolfalsefalse

Theme Props

  • starRatingFilledColor

FAQs

Package last updated on 30 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc