Represent the opaque RadioButton
configuration.
{ value : String
, title : String
, subtitle : Maybe String
}
Represent the RadioButtonChoice
configuration.
radioButton : (model -> Maybe String) -> (String -> msg) -> List RadioButtonChoice -> RadioButton model msg
Create a radioButton.
radioButtonChoice : String -> String -> RadioButtonChoice
Create the 'RadioButtonChoice' configuration.
radioButtonChoiceWithSubtitle : String -> String -> String -> RadioButtonChoice
Create the 'radioButtonChoiceWithSubtitle' configuration.
render : model -> RadioButton model msg -> List (Html msg)
Input
.import Html
import Prima.Pyxis.Form.RadioButton as RadioButton
import Prima.Pyxis.Form.Validation as Validation
...
type Msg =
OnChange String
type alias Model =
{ tipoPolizza: Maybe String }
...
view : Html Msg
view =
Html.div
[]
(Input.email .tipoPolizza OnInput
|> Input.withClass "my-custom-class"
|> Input.withValidation (Maybe.andThen validate << .tipoPolizza)
)
validate : String -> Validation.Type
validate str =
if String.isEmpty str then
Just <| Validation.ErrorWithMessage "Tipo di polizza is empty".
else
Nothing
withAttribute : Html.Attribute msg -> RadioButton model msg -> RadioButton model msg
Adds a generic Html.Attribute to the RadioButton
.
withClass : String -> RadioButton model msg -> RadioButton model msg
Adds a class
to the RadioButton
.
withId : String -> RadioButton model msg -> RadioButton model msg
Adds an id
Html.Attribute to the RadioButton
.
withDisabled : Basics.Bool -> RadioButton model msg -> RadioButton model msg
Adds disabled Html.Attribute to the RadioButton
.
withOnBlur : msg -> RadioButton model msg -> RadioButton model msg
Attaches the onBlur
event to the RadioButton
.
withOnFocus : msg -> RadioButton model msg -> RadioButton model msg
Attaches the onFocus
event to the RadioButton
.
withValidation : (model -> Maybe Prima.Pyxis.Form.Validation.Type) -> RadioButton model msg -> RadioButton model msg
Adds a Validation
rule to the RadioButton
.