Text areas allow users to input, edit, and select multiline text.
import Material.TextArea as TextArea
type Msg
= ValueChanged String
main =
TextArea.filled
(TextArea.config
|> TextArea.setLabel (Just "My text area")
|> TextArea.setValue (Just "hello world")
|> TextArea.setOnInput ValueChanged
|> TextArea.setRows (Just 4)
|> TextArea.setCols (Just 20)
)Specify a message when the user changes the value inside the text area
Specify a message when the user confirms a changed value inside the text area
Specify a text area to be fullwidth
Specify a text area's placeholder
Specify a text area to be disabled
Disabled text areas cannot be interacted with and have no visual interaction effect.
Specify a text area to be required
Specify a text area's minimum length
Specify a text area's maximum length
Specify additional attributes
TextArea.filled TextArea.configText areas may have a visible outlined around them by using their outlined
variant.
TextArea.outlined TextArea.configNote that setFullwidth does not have any effect on an outlined text area.
To make a text area span all of its available width, set its setFullwidth
configuration option to True.
TextArea.filled
(TextArea.config |> TextArea.setFullwidth True)Full width text areas do not support labels and will ignore the setLabel
configuration option. You may use setPlaceholder or provide an extraneous
label for a full width text area.
Outlined text areas do not support setFullwidth and will ignore this
configuration option.
To disable a text area, set its setDisabled configuration option to True.
TextArea.filled
(TextArea.config |> TextArea.setDisabled True)To mark a text area as required, set its setRequired configuration option to
True.
TextArea.filled
(TextArea.config |> TextArea.setRequired True)To mark a text area as valid, set its setValid configuration option to
True.
TextArea.filled (TextArea.config |> TextArea.setValid True)To have a text area display a character counter, specify its setMaxLength
configuration option, and also add a HelperText.characterCounter as a child
of HelperText.helperLine.
[ TextArea.filled
(TextArea.config |> TextArea.setMaxLength (Just 18))
, HelperText.helperLine [] [ HelperText.characterCounter [] ]
]
Configuration of a text area