2017 © Pedro Peláez
 

library bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

image

kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  • Friday, November 3, 2017
  • by kartik-v
  • Repository
  • 67 Watchers
  • 853 Stars
  • 863,706 Installations
  • JavaScript
  • 8 Dependents
  • 1 Suggesters
  • 363 Forks
  • 30 Open issues
  • 24 Versions
  • 8 % Grown

The README.md

Krajee Logo
bootstrap-star-rating
Donate       kartikv

[![Financial Contributors on Open Collective](https://opencollective.com/bootstrap-star-rating/all/badge.svg?label=financial+contributors)](https://opencollective.com/bootstrap-star-rating) [![Bower version](https://badge.fury.io/bo/bootstrap-star-rating.svg)](http://badge.fury.io/bo/bootstrap-star-rating) [![Latest Stable Version](https://poser.pugx.org/kartik-v/bootstrap-star-rating/v/stable)](https://packagist.org/packages/kartik-v/bootstrap-star-rating) [![License](https://poser.pugx.org/kartik-v/bootstrap-star-rating/license)](https://packagist.org/packages/kartik-v/bootstrap-star-rating) [![Packagist Downloads](https://poser.pugx.org/kartik-v/bootstrap-star-rating/downloads)](https://packagist.org/packages/kartik-v/bootstrap-star-rating) [![Monthly Downloads](https://poser.pugx.org/kartik-v/bootstrap-star-rating/d/monthly)](https://packagist.org/packages/kartik-v/bootstrap-star-rating)

A simple yet powerful JQuery star rating plugin for Bootstrap which supports advanced features like fractional star fill and RTL input support. Developed with a focus on utlizing pure CSS-3 styling to render the control. The plugin uses Bootstrap markup and styling by default, but it can be overridden with any other CSS markup. View the documentation or a complete demo at Krajee JQuery plugins., (*1)

NOTE: Release v4.0 is a modified rewrite with various new enhancements and BC breaking features. It allows rendering richer markup for star symbols and offers theming support., (*2)

Star Rating Screenshot, (*3)

Features

  • Convert any HTML input to a star rating control.
  • The plugin automatically converts an input to a star rating control if you set its class = rating. All options to the input can be passed as HTML5 data attributes.
  • You can use the HTML 5 number input for polyfill and the plugin will automatically use the number attributes like min, max, and step. However, number inputs have a problem with decimal values on the Chrome Browser. Read the Browser Support section in the documentation.
  • Involves pure CSS3 styling of the stars. Say goodbye to image sprites or playing with image backgrounds. Offers clean scalable vector icons for consistent display across devices. Optionally one can use the Unicode character set to override symbols.
  • Use any of your favorite font icon frameworks to render your star symbols (for example you can easily use the icons from the FontAwesome library).
  • Render and display fractional star ratings. Configure number of stars, min, max, step, and theoretically support any fractional rating.
  • Uses Bootstrap 5.x, 4.x, 3.x styles & Bootstrap 3.x glyphicons by default. But this can be overridden with plugin parameters and your own CSS styles.
  • Support for RIGHT TO LEFT (RTL) input. Automatically changes star styling for RTL.
  • Ability to clear values and options for the stars. Control where the clear button element can be shown.
  • Reset star rating to the initial value when the form is reset.
  • Ability to control and display caption of the selected stars. Each rated star can have its own caption. Control where the caption element can be shown.
  • Ability to size the rating control including the stars, caption, and clear button. Five prebuilt size templates are available xl, lg, md, sm, and xs.
  • Triggers JQuery events for advanced development. Events currently available are rating.change, rating.clear, rating.reset, rating.refresh, rating.hover, and rating.hoverleave.
  • Disabled and readonly input star rating support.
  • Change stars and caption on mouse hover (new feature since v3.0.0).
  • Change stars and caption on slide and drag for mobile/touch devices (new feature since v3.1.0).
  • Support for translations and locales.

New features/changes since release v4.0

  • BC Breaking Change: The symbol, glyphicon, ratingClass properties have been removed. The functionality is replaced with the theme property (and can also be complemented or implemented separately using the containerClass property).
  • New property theme will assign a CSS class with the rating-<theme-name> to the rating container.
    • Themes included
      • krajee-svg (for displaying svg icons) - default theme since v4.1.0
      • krajee-uni (for displaying Krajee unicode symbols as stars)
      • krajee-fas (for displaying font awesome 5.x icons)
      • krajee-fa (for displaying font awesome 4.x icons)
      • krajee-gly (for displaying bootstrap 3.x glyphicons)
    • Add ability to override and add one's own themes
  • Stars now have a better padding and spacing that can be configured via CSS and themes
  • New property filledStar - will allow one to set the markup for filledStar - will default to
    • <i class="glyphicon glyphicon-star"></i>
  • New property emptyStar - will allow one to set the markup for emptyStar - will default to
    • <i class="glyphicon glyphicon-star-empty"></i>
  • Exclusive support for SVG (and a prebuilt krajee-svg theme that contains two different ready to use SVG icons).
  • Ability to easily set the widget as a "display only" rating via displayOnly property.
  • New property animate to control animation of highlighted stars on hover or click.

NOTE: Refer change log for details on plugin enhancements, fixes, and changes., (*4)

Documentation and Demo

View the plugin documentation and plugin demos at Krajee JQuery plugins., (*5)

Pre-requisites

  1. Bootstrap 5.x, 4.x, 3.x
  2. Latest JQuery
  3. Most browsers supporting CSS3 & JQuery.

Installation

Using Bower

You can use the bower package manager to install. Run:, (*6)

bower install bootstrap-star-rating

Using Composer

You can use the composer package manager to install. Either run:, (*7)

$ php composer.phar require kartik-v/bootstrap-star-rating "@dev"

or add:, (*8)

"kartik-v/bootstrap-star-rating": "@dev"

to your composer.json file, (*9)

NOTE: You can use the sass branch for installation using bootstrap-sass dependency. The master branch can be used for installation using plain bootstrap dependency., (*10)

Manual Install

You can also manually install the plugin easily to your project. Just download the source ZIP or TAR ball and extract the plugin assets (css and js folders) into your project., (*11)

Usage

Step 1: Load the following assets in your header., (*12)


<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css">
<link href="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-star-rating@4.1.2/css/star-rating.min.css" media="all" rel="stylesheet" type="text/css" />


<link href="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-star-rating@4.1.2/themes/krajee-svg/theme.css" media="all" rel="stylesheet" type="text/css" />










If you noticed, you need to load the jquery.min.js and bootstrap.min.css in addition to the star-rating.min.css and star-rating.min.js for the plugin to work with default settings., (*13)

Step 2: Setup your input markup to automatically initialize the rating, (*14)

<input id="input-id" type="text" class="rating" data-size="lg" >

Step 3: Initialize the plugin on your page for other input types. For example,, (*15)

// initialize with defaults
$("#input-id").rating();

// with plugin options (do not attach the CSS class "rating" to your input if using this approach)
$("#input-id").rating({'size':'lg'});

The #input-id is the identifier for the input on your page (that you used to initialize the rating), and this input is hidden automatically by the plugin (by adding the bootstrap CSS class hide)., (*16)

Alternatively, you can directly call the plugin options by setting data attributes to your input field., (*17)

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute]. , (*18)

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute], (*19)

Individuals

, (*20)

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute], (*21)

, (*22)

License

bootstrap-star-rating is released under the BSD-3-Clause License. See the bundled LICENSE.md for details., (*23)

The Versions

03/11 2017

dev-sass

dev-sass https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD-3-Clause

bootstrap rating font svg star awesome glyphicon

03/11 2017

dev-master

9999999-dev https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD-3-Clause

bootstrap rating font svg star awesome glyphicon

03/11 2017

4.0.3

4.0.3.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD-3-Clause

bootstrap rating font svg star awesome glyphicon

27/08 2017

v4.0.2

4.0.2.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD-3-Clause

bootstrap rating font svg star awesome glyphicon

28/02 2016

v4.0.1

4.0.1.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD-3-Clause

bootstrap rating font svg star awesome glyphicon

18/02 2016

v4.0.0

4.0.0.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD-3-Clause

bootstrap rating font svg star awesome glyphicon

16/02 2016

v3.5.8

3.5.8.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD-3-Clause

jquery bootstrap rating star

21/01 2016

v3.5.7

3.5.7.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD-3-Clause

jquery bootstrap rating star

29/12 2015

v3.5.6

3.5.6.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD-3-Clause

jquery bootstrap rating star

22/11 2015

v3.5.5

3.5.5.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD-3-Clause

jquery bootstrap rating star

21/09 2015

v3.5.4

3.5.4.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD-3-Clause

jquery bootstrap rating star

18/06 2015

v3.5.3

3.5.3.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD-3-Clause

jquery bootstrap rating star

10/05 2015

v3.5.2

3.5.2.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD 3-Clause

jquery bootstrap rating star

13/02 2015

v3.5.1

3.5.1.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD 3-Clause

jquery bootstrap rating star

01/02 2015

v3.5.0

3.5.0.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD 3-Clause

jquery bootstrap rating star

15/12 2014

v3.4.0

3.4.0.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD 3-Clause

jquery bootstrap rating star

17/11 2014

v3.3.0

3.3.0.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD 3-Clause

jquery bootstrap rating star

08/11 2014

v3.2.0

3.2.0.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD 3-Clause

jquery bootstrap rating star

04/11 2014

v3.1.0

3.1.0.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD 3-Clause

jquery bootstrap rating star

17/10 2014

v3.0.0

3.0.0.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD 3-Clause

jquery bootstrap rating star

05/10 2014

v2.6.0

2.6.0.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD 3-Clause

jquery bootstrap rating star

29/05 2014

v2.5.0

2.5.0.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD 3-Clause

jquery bootstrap rating star

16/05 2014

v2.0.0

2.0.0.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD 3-Clause

jquery bootstrap rating star

05/04 2014

v1.2.0

1.2.0.0 https://github.com/kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

  Sources   Download

BSD 3-Clause

jquery bootstrap rating star