primait / pyxis-components / Prima.Pyxis.Form.Radio

Configuration


type Radio model msg

Represents the configuration choice for the Radio.


type alias RadioChoice =
{ value : String
, label : String 
}

Represents a choice for the Radio.

Configuration Methods

radio : (model -> Maybe String) -> (String -> msg) -> List RadioChoice -> Radio model msg

Creates the Radio.

radioChoice : String -> String -> RadioChoice

Creates a choice for the Radio.

Rendering

render : model -> Radio model msg -> List (Html msg)

Renders the Radio config.

import Prima.Pyxis.Form.Radio as Radio

view : List (Html Msg)
view =
    [ radioChoice "option_1" "Option 1"
    , radioChoice "option_2" "Option 2"
    ]
        |> Radio.radio
        |> Radio.render

Options

withAttribute : Html.Attribute msg -> Radio model msg -> Radio model msg

Sets an attribute to the Radio config.

withClass : String -> Radio model msg -> Radio model msg

Sets a class to the Radio config.

withDisabled : Basics.Bool -> Radio model msg -> Radio model msg

Sets a disabled to the Radio config.

withId : String -> Radio model msg -> Radio model msg

Sets an id to the Radio config.

withName : String -> Radio model msg -> Radio model msg

Sets a name to the Radio config.

Event Options

withOnBlur : msg -> Radio model msg -> Radio model msg

Sets an onBlur event to the Radio config.

withOnFocus : msg -> Radio model msg -> Radio model msg

Sets an onFocus event to the Radio config.

Validation

withValidation : (model -> Maybe Prima.Pyxis.Form.Validation.Type) -> Radio model msg -> Radio model msg

Adds a validation rule to the Radio.