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

Configuration


type Select model

Represent the opaque Select configuration.


type State

The State of the Select


type Msg
    = OnSelect String
    | OnToggleMenu
    | OnKeyPress (Maybe Prima.Pyxis.Form.Commons.KeyboardEvents.KeyCode)

Represents the Msg of the Select.


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

Represents an option for the Select.

Configuration Methods

select : Select model

Creates the Select.

init : List SelectChoice -> State

Initializes the Select's State.

initWithDefault : String -> List SelectChoice -> State

Initializes the Select's State with a default value.

update : Msg -> State -> State

Updates the Select's State.

selectChoice : String -> String -> SelectChoice

Creates an option for the Select.

Methods

selectedValue : State -> Maybe String

Returns the current SelectChoice.value selected by the user.

subscription : State -> Platform.Sub.Sub Msg

Needed to wire keyboard events to the Select.

open : State -> State

Show the available options for the select.

close : State -> State

Hide the available options for the select.

isOpen : State -> Basics.Bool

Returns whether the menu is open or not.

toggle : State -> State

Toggle the menu openness.

reset : State -> State

Reset selected value.

Rendering

render : model -> State -> Select model -> List (Html Msg)

Renders the Radio config.

Options

withAttribute : Html.Attribute Msg -> Select model -> Select model

Sets an attribute to the Select.

withId : String -> Select model -> Select model

Sets an id to the Select.

withDefaultValue : Maybe String -> Select model -> Select model

Adds a default value to the Select. Useful to teach the component about it's pristine/touched state.

withDisabled : Basics.Bool -> Select model -> Select model

Sets a disabled to the Select.

withClass : String -> Select model -> Select model

Adds a class to the Select.

withLargeSize : Select model -> Select model

Sets a Size to the Select.

withMediumSize : Select model -> Select model

Sets a Size to the Select.

withOverridingClass : String -> Select model -> Select model

Overrides the default classes of the Select.

withPlaceholder : String -> Select model -> Select model

Sets a placeholder to the Select.

withSmallSize : Select model -> Select model

Sets a Size to the Select.

withIsSubmitted : (model -> Basics.Bool) -> Select model -> Select model

Adds an isSubmitted predicate to the Input.

Event Options

withOnBlur : Msg -> Select model -> Select model

Sets an onBlur event to the Select.

withOnFocus : Msg -> Select model -> Select model

Sets an onFocus event to the Select.

Validation

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

Adds a validation rule to the Select.