Slider Edit

An input where the user selects a value from within a given range.

Examples

Installation


  rails generate shadcn-ui slider

Usage

<%= render_slider name: %>

The Slider component introduces:

  • app/helpers/components/slider_helper.rb
  • app/javascript/controllers/ui/slider_controller.js
  • app/views/components/ui/_slider.html.erb

render_slider accepts one keyword argument for the name of the slider element. It optionally accepts a value keyword for the starting value of the slider. The javascript controller is responsible for maintaining the state and visual of the slider from the underlying range input.