| Install | |
|---|---|
composer require sadam/livewire-range-slider |
|
| Latest Version: | v1.1.1 |
| PHP: | ^8.1 |

A feature-rich, customizable range slider component for Laravel Livewire applications, built on noUiSlider with Alpine.js integration.
v1.1.0 - Added Livewire 4 compatibility, updated metadata and documentation. No breaking changes.
Upgrading from v0.10? This release includes significant improvements and breaking changes. Please read the Migration Guide before updating.
Compatibility: Supports Livewire v3 and v4.
Install via Composer:
composer require sadam/livewire-range-slider
Publish the assets:
php artisan vendor:publish --tag=livewire-range-slider-assets
⚠️ Note: The package won’t work properly without publishing these assets.
Optionally, publish the configuration file:
php artisan vendor:publish --tag=livewire-range-slider-config
This version introduces major improvements over the previous v0.10 release:
For existing users: Please see the Migration Guide below for detailed upgrade instructions.
<x-range-slider
wire:model.live="price"
:min="0"
:max="1000"
:step="10"
/>
class PriceFilter extends Component
{
public $price = 500;
}
See Wire Model Modifiers for more options like wire:model.live and wire:model.blur.
<x-range-slider
wire:model="priceRange"
:min="0"
:max="1000"
/>
class PriceFilter extends Component
{
public $priceRange = [200, 800];
// You can also use 3+ handles
// public $quartiles = [100, 300, 600, 900];
}
| Prop | Type | Default | Description |
|---|---|---|---|
min |
int/float | 1 | Minimum value |
max |
int/float | 100 | Maximum value |
step |
float | 1 | Step increment |
tooltips |
bool | true | Show value tooltips |
pips |
bool/array | false | Show scale markers |
theme |
string | 'indigo' | Color theme |
size |
string | 'medium' | Slider size |
variant |
string | 'rounded' | Handle shape |
direction |
string | 'ltr' | Slider direction |
behaviour |
string | 'tap' | Interaction behavior |
Available themes: slate, indigo, teal, orange, cyan, emerald, sky, amber, red, rose, pink, purple
<x-range-slider wire:model="value" theme="emerald" />
See more examples in the Examples section.
Available sizes: small, medium, large
<x-range-slider wire:model="value" size="large" />
Available variants: square, rounded
<x-range-slider wire:model="value" variant="square" />
Show evenly distributed markers:
<x-range-slider wire:model="value" :pips="true" />
Show markers at specific values:
<x-range-slider wire:model="value" :pips="[0, 25, 50, 75, 100]" />
Controls slider interaction. Common values:
tap - Click to set valuedrag - Drag handles onlytap-drag - Both tap and dragsnap - Snap to stepsfixed - Maintain handle distanceSee noUiSlider documentation for all options.
<x-range-slider wire:model="value" behaviour="snap" />
Update on every change (optimized - only fires after drag ends):
<x-range-slider wire:model.live="price" />
Update when handle loses focus:
<x-range-slider wire:model.blur="price" />
Update when form is submitted (default):
<x-range-slider wire:model="price" />
<div>
<x-range-slider
wire:model.live="priceRange"
:min="0"
:max="5000"
:step="50"
theme="indigo"
size="medium"
:pips="[0, 1000, 2500, 5000]"
:tooltips="true"
/>
<p>Price: ${{ $priceRange[0] }} - ${{ $priceRange[1] }}</p>
</div>
<x-range-slider
wire:model="volume"
:min="0"
:max="100"
:step="1"
theme="purple"
size="small"
behaviour="snap"
/>
<x-range-slider
wire:model="ageRange"
:min="18"
:max="100"
:step="1"
:tooltips="true"
:pips="true"
theme="teal"
variant="square"
/>
Customize default values by editing config/livewire-range-slider.php:
return [
'theme' => 'indigo',
'size' => 'medium',
'variant' => 'rounded',
'direction' => 'ltr',
'behaviour' => 'tap',
'pips' => false,
'step' => 1,
'min' => 1,
'max' => 100,
'tooltips' => true,
];
See how to publish the configuration file in the Installation section.
You can customize the published public/vendor/livewire-range-slider/range-slider.css file directly.
See available theme options
The slider fully supports keyboard navigation:
Supports all modern browsers that support Alpine.js and noUiSlider.
This guide will help you migrate from the previous v0.10 version to the current release.
Major Improvements:
app.jsBreaking Changes:
If you installed noUiSlider manually for the old version, remove it:
# Remove from package.json
npm uninstall nouislider
Remove the imports from resources/js/app.js:
// DELETE THESE LINES:
import noUiSlider from 'nouislider';
import 'nouislider/dist/nouislider.css';
window.noUiSlider = noUiSlider;
Rebuild your assets:
npm run build
The new version bundles noUiSlider and publishes it to your public directory:
php artisan vendor:publish --tag=livewire-range-slider-assets
This creates:
public/vendor/livewire-range-slider/nouislider.min.jspublic/vendor/livewire-range-slider/nouislider.min.csspublic/vendor/livewire-range-slider/range-slider.cssFor Single Value Sliders
Before:
public $values = [50]; // Had to be an array
<x-range-slider :min="0" :max="100" :step="1" wire:model="values" />
After:
public $price = 50; // Can now be a single value
<x-range-slider :min="0" :max="100" :step="1" wire:model="price" />
For Range Sliders
Before:
public $values = [30, 70];
<x-range-slider :min="0" :max="100" :step="1" wire:model="values" />
After (same, but with optional enhancements):
public $priceRange = [30, 70];
<x-range-slider
wire:model="priceRange"
:min="0"
:max="100"
:step="1"
theme="indigo"
:tooltips="true"
/>
Before - You had to write custom CSS:
.noUi-target {
background-color: #8BC34A;
height: 12px;
border-radius: 6px;
}
.noUi-handle {
background-color: #212121;
border: 2px solid #FFEB3B;
}
.noUi-connect {
background-color: #FFEB3B;
}
After - Use built-in themes:
<x-range-slider wire:model="price" theme="emerald" size="medium" />
Available themes: slate, indigo, teal, orange, cyan, emerald, sky, amber, red, rose, pink, purple
Add tooltips:
<x-range-slider wire:model="price" :tooltips="true" />
Add scale markers:
<!-- Evenly distributed -->
<x-range-slider wire:model="price" :pips="true" />
<!-- At specific values -->
<x-range-slider wire:model="price" :pips="[0, 25, 50, 75, 100]" />
Choose a size:
<x-range-slider wire:model="price" size="large" />
Choose a variant:
<x-range-slider wire:model="price" variant="square" />
Set project-wide defaults:
php artisan vendor:publish --tag=livewire-range-slider-config
Edit config/livewire-range-slider.php:
return [
'theme' => 'indigo',
'size' => 'medium',
'variant' => 'rounded',
'tooltips' => true,
'pips' => false,
// ... more options
];
| Feature | Old Version | New Version |
|---|---|---|
| Installation | npm install + app.js config | Just publish assets |
| Wire Model | Arrays only ($values = [50]) |
Single value or array |
| Props | 3 (min, max, step) | 11 (see Available Props) |
| Themes | Manual CSS required | 12 built-in themes |
| Tooltips | Manual CSS required | Built-in prop |
| Pips | Not available | Built-in prop |
| Sizes | Not available | small, medium, large |
| Configuration | Not available | Config file support |
| PHP Version | Any | 8.1+ |
Before:
// Component
public $values = [200, 800];
<x-range-slider :min="0" :max="1000" :step="10" wire:model="values" />
/* Custom CSS required */
.noUi-target { background-color: #8BC34A; }
.noUi-handle { background-color: #212121; }
.noUi-connect { background-color: #FFEB3B; }
After:
// Component
public $priceRange = [200, 800];
<x-range-slider
wire:model.live="priceRange"
:min="0"
:max="1000"
:step="10"
theme="emerald"
size="medium"
:tooltips="true"
:pips="[0, 250, 500, 750, 1000]"
/>
No CSS required!
Slider Not Appearing
Make sure you published the assets:
php artisan vendor:publish --tag=livewire-range-slider-assets --force
See the Installation section for more details.
Old Styles Conflicting
If you have custom CSS from the old version, it might conflict with the new themes. Either:
public/vendor/livewire-range-slider/range-slider.css file directly.
See available theme optionsWire Model Not Working
Make sure you're using the correct binding:
public $price = 50;public $range = [20, 80];public $values = [10, 30, 60, 90];See Basic Usage for examples.
Built with:
MIT License. See LICENSE for details.