The range slider component provides a simple and lightweight solution for sliders with two handles in your laravel application.
To use the range slider component, you need to import the corresponding assets. These assets are located
in vendor/schaefersoft/laravel-ui/resources/{js,css} and include both JavaScript and CSS files.
There are two ways to import the required assets:
You can import all assets from the package, which is only required once per project, even if you use multiple components from the laravel-ui package.
Add the following lines to the corresponding files:
resources/css/app.css[@import](https://github.com/import) "../../vendor/schaefersoft/laravel-ui/resources/css/laravel-ui.css";
resources/js/app.jsimport '../../vendor/schaefersoft/laravel-ui/resources/js/laravel-ui';
To reduce bundle size and improve overall performance, you can import only the assets required for the Expand component.
resources/css/app.css[@import](https://github.com/import) "../../vendor/schaefersoft/laravel-ui/resources/css/modules/range-slider.css";
resources/js/app.jsimport '../../vendor/schaefersoft/laravel-ui/resources/js/modules/range-slider';
To use the range slider component, follow these steps.
<x-ui::expand>
<x-ui::range-slider lower-name=""
upper-name=""/>
</x-ui::expand>
<x-ui::range-slider lower-name="height-lower"
upper-name="height-upper"
:lower-value="old('height-lower', 10)"
:upper-value="old('height-upper', 90)"/>
| Name | Type | Purpose | Default value | Example value |
|---|---|---|---|---|
| $lowerName | string, required | Set the name and ID of the lower input value | - | heigth-lower |
| $upperName | string, required | Set the name and ID of the lower upper value | - | heigth-upper |
| $min | int, nullable | Set the min value of both inputs | 0 | 50 |
| $max | int, nullable | Set the max value of both inputs | 100 | 180 |
| $lowerValue | int, nullable | Set the current lower value | null | 20 |
| $upperValue | int, nullable | Set the current upper value | null | 80 |
| $showDetails | bool, nullable | Set if the details (values below ths slider) should be displayed | true | false |
| $prefix | string, nullable | Prepends something to the values below the silder (only if $showDetails = true) | null | Cal. |
| $suffix | string, nullable | Appends something to the values below the silder (only if $showDetails = true) | null | cm |
| $lowerDisabled | boolean, nullable | Set if the lower input is disabled | null | true |
| $upperDisabled | boolean, nullable | Set if the upper input is disabled | null | true |
How can I help you explore Laravel packages today?