carwow / elm-slider-old / SingleSliderOld

A single slider built natively in Elm

Model


type alias Model =
{ min : Basics.Float
, max : Basics.Float
, step : Basics.Float
, value : Basics.Float
, minFormatter : Basics.Float -> String
, maxFormatter : Basics.Float -> String
, currentValueFormatter : Basics.Float -> Basics.Float -> String
, disabled : Basics.Bool
, progressDirection : ProgressDirection
, reversed : Basics.Bool 
}

The base model for the slider

defaultModel : Model

Default model


type ProgressDirection
    = ProgressLeft
    | ProgressRight

Progress Bar direction (left or right)

Update


type Msg
    = TrackClicked String
    | OnInput String Basics.Bool
    | OnChange String

The basic type accepted by the update

update : Msg -> Model -> ( Model, Platform.Cmd.Cmd Msg, Basics.Bool )

takes a model and a message and applies it to create an updated model

subscriptions : Model -> Platform.Sub.Sub Msg

Returns the subscriptions necessary to run

View

view : Model -> Html Msg

Displays the slider