Socket
Socket
Sign inDemoInstall

bpk-component-star-rating

Package Overview
Dependencies
246
Maintainers
6
Versions
434
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bpk-component-star-rating

Backpack rating star component.


Version published
Weekly downloads
303
increased by10000%
Maintainers
6
Install size
36.6 MB
Created
Weekly downloads
 

Readme

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

Last updated on 30 Sep 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc