jjagielka / select-menu / Menu

Make Dropdown and FocusList work together.

Types


type alias Item msg =
FocusList.Item msg

Menu item type.


type Menu

Menu type.


type Msg

Internal select/menu messages.

TEA

init : String -> Menu

Initialize a menu object. As the browser focus is used, menu requires unique identifier.

update : Msg -> Menu -> ( Menu, Platform.Cmd.Cmd Msg )

Standard elm update.

view : Menu -> List (Html.Attribute Msg) -> List (Item Msg) -> Html Msg

Renders the menu. Attributes are used to style the dropdown container. Second parameter is an arbitrary list of menut Item's.

Items

link : String -> List (Html.Attribute msg) -> List (Html msg) -> Item msg

Html link menu item. Click/Enter triggers url redirection.

button : String -> List (Html.Attribute msg) -> List (Html msg) -> Item msg

Button like menu. Use it when you need select mode - no url redirection but value collection. This is used with onSelect attributes.

Events

open : Menu -> Menu

Changes the menu state to Open

trigger : (Msg -> msg) -> Menu -> List (Html.Attribute msg)

Menu control. Add that set of attributes to the element controling the menu: button, input, ...

onSelect : (String -> msg) -> Menu -> Html.Attribute msg

Menu selection catching. Add this as a Html.Attribute to the container carring the menu.