Class: Shadcn::SliderComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::SliderComponent
- Defined in:
- app/components/shadcn/slider_component.rb
Overview
Slider component for selecting values within a range Uses a native range input with custom styling for reliability Matches shadcn/ui Slider component appearance
Constant Summary collapse
- BASE_CLASSES =
"shadcn-slider w-full h-1.5 rounded-full appearance-none cursor-pointer bg-primary/20 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
-
#initialize(name: nil, value: 0, min: 0, max: 100, step: 1, disabled: false, **options) ⇒ SliderComponent
constructor
A new instance of SliderComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(name: nil, value: 0, min: 0, max: 100, step: 1, disabled: false, **options) ⇒ SliderComponent
Returns a new instance of SliderComponent.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/components/shadcn/slider_component.rb', line 23 def initialize( name: nil, value: 0, min: 0, max: 100, step: 1, disabled: false, ** ) super(**) @name = name @value = value.to_f @min = min.to_f @max = max.to_f @step = step.to_f @disabled = disabled end |