Ship faster with goilerplate templUI Pro

Slider

Control for selecting a numeric value within a range.

Source Tailwind CSS JavaScript

Installation

templui add slider

Load the script once in your layout:

<head>
  @slider.Script()
</head>

Examples

Value

Steps

Disabled

External Value

External value (linked to the slider):

%

API Reference

Required parameter
Hover for description

Slider

Main slider container component.

Name Type Default
ID

Unique identifier for the slider component

string
""
Class

Additional CSS classes to apply to the slider container

string
""
Attributes

Additional HTML attributes to apply to the slider container

templ.Attributes
nil

Input

The actual range input element.

Name Type Default
ID

Unique identifier for the input element

string
randomID
Class

Additional CSS classes to apply to the input

string
""
Attributes

Additional HTML attributes to apply to the input

templ.Attributes
nil
Name

Name attribute for the input field

string
""
Min

Minimum value for the slider

int
0
Max

Maximum value for the slider

int
0
Step

Step increment for slider values

int
0
Value

Current value of the slider

int
0
Disabled

Whether the slider is disabled

bool
false

Value

Display element for the current slider value.

Name Type Default
ID

Unique identifier for the value display element

string
""
Class

Additional CSS classes to apply to the value display

string
""
Attributes

Additional HTML attributes to apply to the value display

templ.Attributes
nil
For

ID of the slider input this value display is connected to

string
""
Axel Adrian