Socket
Socket
Sign inDemoInstall

rc-rate

Package Overview
Dependencies
10
Maintainers
6
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rc-rate

React Star Rate Component


Version published
Weekly downloads
965K
decreased by-19.01%
Maintainers
6
Install size
430 kB
Created
Weekly downloads
 

Package description

What is rc-rate?

The rc-rate npm package is a React component for visualizing and interacting with a star rating system. It allows users to display ratings in the form of stars and also to collect rating input from users.

What are rc-rate's main functionalities?

Display static star ratings

This feature allows you to display a static star rating that users cannot interact with. The 'defaultValue' prop sets the number of active stars, and the 'disabled' prop ensures that the rating is read-only.

import Rate from 'rc-rate';

<Rate defaultValue={3} disabled />

Collect user ratings

This feature enables the collection of star ratings from users. The 'onChange' prop is a callback function that is called whenever the user selects a new rating.

import Rate from 'rc-rate';

<Rate defaultValue={0} onChange={handleRateChange} />

Customize the appearance of the stars

This feature allows customization of the star icons. The 'character' prop can be used to render a custom React element instead of the default star.

import Rate from 'rc-rate';

<Rate defaultValue={3} character={<i className='fa fa-heart' />} />

Other packages similar to rc-rate

Readme

Source

rc-rate


React Rate Component

NPM version build status Test coverage gemnasium deps npm download

Screenshots

Development

npm install
npm start

Example

http://localhost:8000/examples/

online example: http://react-component.github.io/rate/

install

rc-rate

Usage

import React from 'react'
import ReactDOM from 'react-dom'
import Rate from 'rc-rate'

ReactDOM.render(
  <Rate />,
  document.getElementById('root')
)

with styled-components

import React from 'react'
import ReactDOM from 'react-dom'
import Rate from 'rc-rate'
import styled from 'styled-components'

cosnt StyledRate = styled(Rate)`
  &.rc-rate {
    font-size: ${({ size }) => size}px;
  }
`

ReactDOM.render(
  <StyledRate size="24" />,
  document.getElementById('root')
)

API

props

nametypedefaultdescription
countnumber5star numbers
valuenumbercontrolled value
defaultValuenumber0initial value
allowHalfboolfalsesupport half star
allowClearbooltruereset when click again
styleobject{}
onChangefunction(value: Number)`onChange` will be triggered when click.
onHoverChangefunction(value: Number)`onHoverChange` will be triggered when hover on stars.
characterReactNodeThe each character of rate
disabledboolfalse

Test Case

npm test
npm run chrome-test

Coverage

npm run coverage

open coverage/ dir

License

rc-rate is released under the MIT license.

Keywords

FAQs

Last updated on 04 Feb 2020

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