primait/pyxis-components/7.0.0

NOTE: the latest version is 9.0.3

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 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.

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.

Needed to wire keyboard events to the Select.

Show the available options for the select.

Hide the available options for the select.

isOpen : State -> Bool

Returns whether the menu is open or not.

Toggle the menu openness.

Reset selected value.

Rendering

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

Renders the Radio config.

Options

withAttribute : 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 : 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.

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 Type) -> Select model -> Select model

Adds a validation rule to the Select.