Rerouted (regenerated, verified). Same repository and tag, but GitHub now builds the zip with different bytes, so it no longer matches the SHA-1 package.elm-lang.org recorded. The Lamdera package server serves a copy recovered from https://github.com/aforemny/material-components-web-elm.
What we checked: Tag 6.0.0 is still on github.com/aforemny/material-components-web-elm; its commit fa5f16f0eddc is from 2020-10-08 13:01 UTC, before the version was published (2020-10-08 13:03 UTC); every file Elm uses matches a copy in a Lamdera package cache from 2021-02-13, from before the change; elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip's SHA-1 is not the published one (GitHub's zip no longer comes out byte for byte the same), so the contents were checked instead.
The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.
Details · package.elm-lang.org's zip: https://github.com/aforemny/material-components-web-elm/zipball/6.0.0/
Text fields allow users to input, edit, and select text.
import Material.TextField as TextField
type Msg
= ValueChanged String
main =
TextField.filled
(TextField.config
|> TextField.setLabel (Just "My text field")
|> TextField.setValue (Just "hello world")
|> TextField.setOnInput ValueChanged
)Specify a message when the user changes the value inside the text field
Specify a message when the user confirms a changed value inside the text field
Specify a text field to be fullwidth
Specify a text field's placeholder
Specify a text field to be disabled
Disabled text fields cannot be interacted with and have no visual interaction effect.
Specify a text field to be required
Specify a text field's minimum length
Specify a text field's maximum length
Specify a text field's pattern
Specify a text field's leading icon
Specify a text field's trailing icon
Specify a text field's input to end-aligned
Specify additional attributes
TextField.filled TextField.configText fields may have a visible outlined around them by using their
outlined variant.
TextField.outlined TextField.configNote that setFullwidth does not have any effect on an outlined text field.
To make a text field span all of its available width, set its setFullwidth
configuration option to True.
TextField.filled
(TextField.config |> TextField.setFullwidth True)Full width text fields do not support a label and will ignore the setLabel
configuration option. You may use setPlaceholder or provide an extraneous
label for a full width text field.
Outlined text fields do not support setFullwidth and wll ignore this
configuration option.
To disable a text field, set its setDisabled configuration option to True.
TextField.filled
(TextField.config |> TextField.setDisabled True)To mark a text field as an input for entering a passwort, use its setType
configuration option to specify "password".
TextField.filled
(TextField.config |> TextField.setType (Just "password"))Other input types besides "password" may or may not be supported.
To mark a text field as required, set its setRequired configuration option to
True.
TextField.filled
(TextField.config |> TextField.setRequired True)To mark a text field as valid, set its setValid configuration option to
True.
TextField.filled
(TextField.config |> TextField.setValid True)To have a text field display a leading icon, use its setLeadingIcon
configuration option to specify a value of Icon.
TextField.filled
(TextField.config
|> TextField.setLeadingIcon
(Just (TextFieldIcon.icon "wifi"))
)To have a text field display a trailing icon, use its setTrailingIcon
configuration option to specify a value of Icon.
TextField.filled
(TextField.config
|> TextField.setTrailingIcon
(Just (TextFieldIcon.icon "clear"))
)This library natively supports Material Icons. However, you may also include SVG or custom icons such as FontAwesome.
See Material.TextField.Icon for more information.
To have a text field display a prefix text such as a currency symbol, set its
setPrefix configuration option.
TextField.filled
(TextField.config
|> TextField.setPrefix (Just "$")
)To have a text field display a suffix text such as a unit of mass, set its
setSuffix configuration option.
TextField.filled
(TextField.config
|> TextField.setSuffix (Just "kg")
)To have a text field end align its input, set its setEndAligned configuration
option to True.
TextField.filled
(TextField.config
|> TextField.setEndAligned True
)To have a text field display a character counter, specify its setMaxLength
configuration option, and also add a HelperText.characterCounter as a child
of HelperText.helperLine.
[ TextField.filled
(TextField.config |> TextField.setMaxLength (Just 18))
, HelperText.helperLine [] [ HelperText.characterCounter [] ]
]You may programatically focus a text field by assigning an id attribute to it
and use Browser.Dom.focus.
TextField.filled
(TextField.config
|> TextField.setAttributes
[ Html.Attributes.id "my-text-field" ]
)
Configuration of a text field