Day 13 - Component Challenge

Challenge UI with Livewire & Alpine.js

Day 13

Day 13

Range Slider & Rating

Interactive range sliders and star rating with real-time feedback

Range Slider

Pure Alpine.js range sliders with real-time value display. Single or double slider support.

Features

  • Single & double range support
  • Real-time value updates
  • Customizable min/max/step
  • Livewire binding support
  • 3 size variants

Single Slider (Volume)

0 100

Double Slider (Price Range)

0 100

Range: 25 - 75 FCFA

Temperature Control

-10 40

Sizes

Small

0 100

Medium (default)

0 100

Large

0 100

Rating / Star Input

Interactive star rating component with hover effects and real-time feedback.

Features

  • Hover preview effects
  • Click to rate
  • Readonly mode for display
  • Customizable max stars
  • Color variants

Rate Your Experience

Your rating: 0 / 5

Product Rating (Readonly)

(1,234 reviews)

Color Variants

Default
Primary
Red

Sizes

Small
Medium
Large

Custom Max Stars

3 Stars
10 Stars

Usage Examples

Range Slider Usage

Range Slider Component

The <x-ui.range-slider> component provides interactive range selection with single or double sliders. 100% Alpine.js with real-time value display.

Basic Usage (Single Slider)

<x-ui.range-slider
:min="0"
:max="100"
:step="1"
/>

With Livewire Binding

{{-- In your Livewire component --}}
public $volume = 50;
 
{{-- In your blade view --}}
<x-ui.range-slider
wire:model.live="volume"
:min="0"
:max="100"
/>

Double Slider (Range)

{{-- In your Livewire component --}}
public $price = [25, 75];
 
{{-- In your blade view --}}
<x-ui.range-slider
wire:model.live="price"
:min="0"
:max="100"
:step="5"
type="double"
/>

With Custom Labels

<x-ui.range-slider
:min="-10"
:max="40"
:step="0.5"
:showLabels="true"
:showValue="true"
/>

Color Variants

<x-ui.range-slider variant="default" />
<x-ui.range-slider variant="primary" />
<x-ui.range-slider variant="success" />

Sizes

<x-ui.range-slider size="sm" />
<x-ui.range-slider size="md" />
<x-ui.range-slider size="lg" />

Props Reference

Prop Type Default Description
min int 0 Minimum value
max int 100 Maximum value
step int|float 1 Step increment
showValue bool true Display current value
showLabels bool true Show min/max labels
size string 'md' 'sm', 'md', 'lg'
variant string 'default' 'default', 'primary', 'success'
type string 'single' 'single', 'double'

Use Cases

  • Volume Control: Audio, video playback settings
  • Price Range Filter: E-commerce filtering
  • Temperature Settings: Climate control interfaces
  • Progress Indicators: Interactive progress bars
  • Opacity/Transparency: Image/design tools
  • Age/Date Ranges: Form filters

Rating Usage

Rating / Star Input Component

The <x-ui.rating> component provides interactive star rating with hover effects. Perfect for reviews and feedback forms.

Basic Usage

<x-ui.rating />

With Livewire Binding

{{-- In your Livewire component --}}
public $rating = 0;
 
{{-- In your blade view --}}
<x-ui.rating
wire:model.live="rating"
:showValue="true"
/>

Readonly Display

<x-ui.rating
:value="4.5"
:readonly="true"
:showValue="true"
/>

Custom Max Stars

<x-ui.rating :max="3" />
<x-ui.rating :max="10" />

Color Variants

<x-ui.rating variant="default" /> {{-- Yellow stars --}}
<x-ui.rating variant="primary" /> {{-- Primary color --}}
<x-ui.rating variant="red" /> {{-- Red stars --}}

Sizes

<x-ui.rating size="sm" />
<x-ui.rating size="md" />
<x-ui.rating size="lg" />

With Value Display

<x-ui.rating
:value="4"
:readonly="true"
:showValue="true"
/>
<span class="text-sm">(1,234 reviews)</span>

Props Reference

Prop Type Default Description
max int 5 Maximum number of stars
readonly bool false Disable interaction
size string 'md' 'sm', 'md', 'lg'
showValue bool false Display numeric value
allowHalf bool false Allow half-star ratings
variant string 'default' 'default', 'primary', 'red'

Use Cases

  • Product Reviews: E-commerce ratings
  • Service Feedback: Customer satisfaction
  • Content Rating: Blog posts, videos
  • Skill Assessment: Profile ratings
  • Quality Indicators: Performance metrics
  • User Preferences: Favorite items