TextArea.import Html
import Prima.Pyxis.Form.TextArea as TextArea
import Prima.Pyxis.Form.Validation as Validation
...
type Msg =
OnInput String
type alias Model =
{ note: Maybe String }
...
view : Html Msg
view =
Html.div
[]
(TextArea.textArea .note OnInput
|> Input.withClass "my-custom-class"
|> Input.withValidation (Maybe.andThen validate << .note)
)
validate : String -> Validation.Type
validate str =
if String.isEmpty str then
Just <| Validation.ErrorWithMessage "Note is empty".
else
NothingAdds a generic Html.Attribute to the TextArea.
Adds a default value to the Textarea.
Useful to teach the component about it's pristine/touched state.
Adds a disabled Html.Attribute to the TextArea.
Adds an id Html.Attribute to the TextArea.
Adds a size of Medium to the TextArea.
Sets a size of Small to the TextArea.
Adds a size of Large to the TextArea.
Adds a name Html.Attribute to the TextArea.
Adds a placeholder Html.Attribute to the TextArea.
Adds an isSubmitted predicate to the TextArea.
Attaches the onBlur event to the TextArea.
Attaches the onFocus event to the TextArea.
Adds a Validation rule to the TextArea.
Represent the opaque
TextAreaconfiguration.