Commonly used Html element with extra functionality.
This library implements reusable views instead of nested component, making it fit nicely in your view function, and doesn't complicate your update function.
See the source code of the demo page.
Html input element that only accept numeric values.
See:
Input.BigNumberto work with big number that can't be stored usingInt
maxLengthis the maximum number of character allowed in this input. Set toNothingfor no limit.maxValueis the maximum number value allowed in this input. Set toNothingfor no limit.minValueis the minimum number value allowed in this input. Set toNothingfor no limit.onInputis the Msg tagger for the onInput event.hasFocusis an optional Msg tagger for onFocus/onBlur event.
type Msg = InputUpdated String | FocusUpdated Bool
Input.Number.input
{ onInput = InputUpdated
, maxLength = Nothing
, maxValue = 1000
, minValue = 10
, hasFocus = Just FocusUpdated
}
[ class "numberInput"
...
]
model.currentValueHtml input element with extra feature.
maxLengthis the maximum number of character allowed in this input. Set toNothingfor no limit.onInputis the Msg tagger for the onInput event.hasFocusis an optional Msg tagger for onFocus/onBlur event.
type Msg = InputUpdated String | FocusUpdated Bool
Input.Text.input
{ maxLength = 10
, onInput = InputUpdated
, hasFocus = Just FocusUpdated
}
[ class "textInput"
...
]
model.currentValueHtml input element with formatting.
patternis the pattern used to format the input value. e.g.: (###) ###-####inputCharacter: is the special character used to represent user input. Default value:#toMsg: is the Msg for updating internalStateof the element.onInputis the Msg tagger for the onInput event.hasFocusis an optional Msg tagger for onFocus/onBlur event.
type Msg
= InputUpdated String
| StateUpdated MaskedInput.State
| FocusUpdated Bool
MaskedInput.Text.input
{ pattern = "(###) ###-####"
, inputCharacter = '#'
, onInput = InputUpdated
, toMsg = StateUpdated
, hasFocus = Just FocusUpdated
}
[ class "masked-input"
...
]
model.currentState
model.currentValueHtml select element
itemsis content of the dropdown.emptyItemis the item for when the nothing is selected. Set toNothingfor no empty item.onChangeis the message for when the selected value in the dropdown is changed.
type Msg = DropdownChanged String
Html.div []
[ Dropdown.dropdown
(Dropdown.defaultOptions DropdownChanged)
[ class "my-dropdown" ]
model.selectedDropdownValue
]Html select element with multiple selection
itemsis content of the dropdown.onChangeis the message for when the selected value in the multi-select is changed.
type Msg = MultiSelectChanged (List String)
Html.div []
[ MultiSelect.multiSelect
(defaultOptions MultiSelectChanged)
[ class "my-multiSelect" ]
model.selectedValues
]Moved to abadi199/datetimepicker