mdgriffith/stylish-elephants/8.0.0

NOTE: the latest version is 8.1.0

Element.Input

Inputs

List (Attribute msg)
-> { onPress : Maybe msg
, label : Element msg
}
-> Element msg

A standard button.

The onPress handler will be fired either onClick or when the element is focused and the enter key has been pressed.

import Element.Input as Input


Input.button []
    { onPress = Just ClickMsg
    , label = text "My Button"
    }

onPress takes a Maybe msg. If you provide the value Nothing, then the button will be disabled.

List (Attribute msg)
-> { onChange : Bool -> msg
, icon : Bool -> Element msg
, checked : Bool
, label : Label msg
}
-> Element msg
defaultCheckbox : Bool -> Element msg
List (Attribute msg)
-> { onChange : String -> msg
, text : String
, placeholder : Maybe (Placeholder msg)
, label : Label msg
}
-> Element msg
type Placeholder msg
placeholder : List (Attribute msg) -> Element msg -> Placeholder msg
List (Attribute msg)
-> { onChange : String -> msg
, text : String
, placeholder : Maybe (Placeholder msg)
, label : Label msg
}
-> Element msg
List (Attribute msg)
-> { onChange : String -> msg
, text : String
, placeholder : Maybe (Placeholder msg)
, label : Label msg
, show : Bool
}
-> Element msg

A password input that allows the browser to autofill.

It's newPassword instead of just password because it gives the browser a hint on what type of password input it is.

A password takes all the arguments a normal Input.text would, and also show, which will remove the password mask (e.g. **** vs pass1234)

List (Attribute msg)
-> { onChange : String -> msg
, text : String
, placeholder : Maybe (Placeholder msg)
, label : Label msg
, show : Bool
}
-> Element msg
List (Attribute msg)
-> { onChange : String -> msg
, text : String
, placeholder : Maybe (Placeholder msg)
, label : Label msg
}
-> Element msg
List (Attribute msg)
-> { onChange : String -> msg
, text : String
, placeholder : Maybe (Placeholder msg)
, label : Label msg
}
-> Element msg
List (Attribute msg)
-> { onChange : String -> msg
, text : String
, placeholder : Maybe (Placeholder msg)
, label : Label msg
, spellcheck : Bool
}
-> Element msg
List (Attribute msg)
-> { onChange : Float -> msg
, label : Label msg
, min : Float
, max : Float
, value : Float
, thumb : Thumb
, step : Maybe Float
}
-> Element msg

A slider input, good for receiving float values.

Input.slider
    [ Element.height (Element.px 30)
    -- Here is where we're creating/styling the "track"
    , Element.behindContent
        (Element.el
            [ Element.width Element.fill
            , Element.height (Element.px 2)
            , Element.centerY
            , Background.color grey
            , Border.rounded 2
            ]
            Element.none
        )
    ]
    { onChange = AdjustValue
    , label = Input.labelAbove [] (text "My Slider Value")
    , min = 0
    , max = 75
    , step = Nothing
    , value = model.sliderValue
    , thumb =
        Input.defaultThumb
    }

The thumb is the icon that you can move around.

The slider can be vertical or horizontal depending on the width/height of the slider.

- `height fill` and `width (px someWidth)` will cause the slider to be vertical.
- `height (px someHeight)` and `width (px someWidth)` where `someHeight` > `someWidth` will also do it.
- otherwise, the sldier will be horizontal.
type Thumb
thumb : List (Attribute Never) -> Thumb
List (Attribute msg)
-> { onChange : option -> msg
, options : List (Option option msg)
, selected : Maybe option
, label : Label msg
}
-> Element msg
Input.radio
    [ padding 10
    , spacing 20
    ]
    { onChange = ChooseLunch
    , selected = Just model.lunch
    , label = Input.labelAbove (text "Lunch")
    , options =
        [ Input.styledChoice Burrito <|
            \selected ->
                Element.row
                    [ spacing 5 ]
                    [ el None [] <|
                        if selected then
                            text ":D"
                        else
                            text ":("
                    , text "burrito"
                    ]
        , Input.option Taco (text "Taco!")
        , Input.option Gyro (text "Gyro")
        ]
    }
List (Attribute msg)
-> { onChange : option -> msg
, options : List (Option option msg)
, selected : Maybe option
, label : Label msg
}
-> Element msg

Same as radio, but displayed as a row

type Option value msg

Add choices to your radio and select menus.

option : value -> Element msg -> Option value msg
optionWith : value -> (OptionState -> Element msg) -> Option value msg
= Idle
| Focused
| Selected

Labels

type Label msg

Every input has a required label.

labelAbove : List (Attribute msg) -> Element msg -> Label msg
labelBelow : List (Attribute msg) -> Element msg -> Label msg
labelLeft : List (Attribute msg) -> Element msg -> Label msg
labelRight : List (Attribute msg) -> Element msg -> Label msg
focusedOnLoad : Attribute msg