stephenreddek / elm-range-slider / RangeSlider

A slider built natively in Elm

Model


type RangeSlider

The base model for the slider

getValues : RangeSlider -> ( Basics.Float, Basics.Float )

Gets the current from and to values (from, to)

getSelectedValues : RangeSlider -> ( Basics.Float, Basics.Float )

Gets the last selected from and to values (from, to)

Update


type Msg

The basic type accepted by the update

update : Msg -> RangeSlider -> RangeSlider

Takes a Msg and a RangeSlider and applies it to create an updated RangeSlider

subscriptions : RangeSlider -> Platform.Sub.Sub Msg

Returns the subscriptions necessary to run

Configuring the slider

init : RangeSlider

Returns a default range slider


type alias AxisTick =
{ value : Basics.Float
, isLabeled : Basics.Bool 
}

Represents a tick that goes along the X axis. The value determines where it should go, isLabeled determines if the it should have a label below. The label is formatted by the formatter.

setDimensions : Basics.Float -> Basics.Float -> RangeSlider -> RangeSlider

Sets the width and height of the range slider when rendered

setExtents : Basics.Float -> Basics.Float -> RangeSlider -> RangeSlider

Sets the minimum and maximum values possible to select

setFormatter : (Basics.Float -> String) -> RangeSlider -> RangeSlider

Formats the value displayed above the handles and for axis ticks

setStepSize : Maybe Basics.Float -> RangeSlider -> RangeSlider

Sets the step size which determines the interval for possible values

setAxisTicks : List AxisTick -> RangeSlider -> RangeSlider

Sets the ticks that will appear in the x-axis.

setValues : Basics.Float -> Basics.Float -> RangeSlider -> RangeSlider

Sets the position of the 'from' handle and the 'to' handle. Not intended to be used after the initial setup - it may not act as expected if the sliders are currently being moved.

View

view : RangeSlider -> Html Msg

Displays the range slider