Star Rating Examples

Real-world examples and interactive demonstrations

Size Variants

Star ratings come in four sizes to fit different contexts, from inline text to hero sections.

Small (16px):
Medium (24px):
Large (32px):
XL (48px):
Size Variants • HTML
<div data-rsl-star-rating data-star-size="small" data-star-value="4"></div>
<div data-rsl-star-rating data-star-size="medium" data-star-value="4"></div>
<div data-rsl-star-rating data-star-size="large" data-star-value="4"></div>
<div data-rsl-star-rating data-star-size="xl" data-star-value="4"></div>

Icon Variants

Choose from stars, hearts, or thumbs depending on your use case.

Stars:
Hearts:
Thumbs:
Icon Variants • HTML
<!-- Stars (default) -->
<div data-rsl-star-rating data-star-icon="star" data-star-value="4.5"></div>

<!-- Hearts for favorites/likes -->
<div data-rsl-star-rating data-star-icon="heart" data-star-value="4"></div>

<!-- Thumbs for approval ratings -->
<div data-rsl-star-rating data-star-icon="thumb" data-star-value="3.5"></div>

Custom Colors

Override default colors using data attributes for brand consistency.

Default Gold:
Purple Theme:
Blue Theme:
Green Theme:
Custom Colors • HTML
<div data-rsl-star-rating
     data-star-value="4"
     data-star-color="#9c27b0"
     data-star-empty-color="#e1bee7">
</div>

Product Card Integration

A typical e-commerce product card with read-only rating display.

Premium Wireless Headphones

(2,847 reviews)
$299.00
Product Card • HTML
<div class="product-card">
    <img src="product.jpg" alt="Product" class="product-image">
    <h3 class="product-title">Premium Wireless Headphones</h3>
    <div class="product-rating">
        <div data-rsl-star-rating
             data-star-value="4.5"
             data-star-readonly="true"
             data-star-size="small"></div>
        <span class="product-reviews">(2,847 reviews)</span>
    </div>
    <div class="product-price">$299.00</div>
</div>

Review Form

Interactive rating with form integration, label, and clear button.

Write a Review

Review Form • HTML
<form class="review-form">
    <div data-rsl-star-rating
         data-star-name="rating"
         data-star-required="true"
         data-star-label="Your Rating"
         data-star-clearable="true"
         data-star-size="large"></div>

    <textarea name="review" placeholder="Tell us about your experience..."></textarea>

    <button type="submit">Submit Review</button>
</form>

Comparison Display

Display multiple ratings side-by-side for comparison.

Basic Plan

Good for starters

Pro Plan

Most popular

Enterprise Plan

Full features

Comparison Display • HTML
<div class="comparison-grid">
    <div class="comparison-item">
        <h4>Basic Plan</h4>
        <div data-rsl-star-rating
             data-star-value="3"
             data-star-readonly="true"
             data-star-show-value="true"></div>
        <p>Good for starters</p>
    </div>
    <div class="comparison-item">
        <h4>Pro Plan</h4>
        <div data-rsl-star-rating
             data-star-value="4"
             data-star-readonly="true"
             data-star-show-value="true"></div>
        <p>Most popular</p>
    </div>
    <div class="comparison-item">
        <h4>Enterprise Plan</h4>
        <div data-rsl-star-rating
             data-star-value="5"
             data-star-readonly="true"
             data-star-show-value="true"></div>
        <p>Full features</p>
    </div>
</div>

Custom Max Stars

Configure more or fewer stars for different rating scales.

3 Stars:
5 Stars (default):
10 Stars:
Custom Max Stars • HTML
<!-- 3-star rating -->
<div data-rsl-star-rating data-star-max="3" data-star-value="2"></div>

<!-- 10-star rating (like IMDB) -->
<div data-rsl-star-rating data-star-max="10" data-star-value="7"></div>

Programmatic Control

Use the JavaScript API to control ratings dynamically.

Rating:
// Event log will appear here
JavaScript API • JS
const rating = document.getElementById('my-rating');

// Set value programmatically
RSL.StarRating.setValue(rating, 4.5);

// Get current value
const value = RSL.StarRating.getValue(rating);

// Clear rating
RSL.StarRating.clear(rating);

// Listen for changes
rating.addEventListener('rsl-star-change', function(e) {
    console.log('Rating changed to:', e.detail.value);
});

See FilterBus in Action

Watch how Star Rating Filter works with other components. This live demo shows Filter + Smart Table + KPI Cards + Charts all working together.

View Live Dashboard Demo
API Reference Playground