orus-io/elm-orus-ui/1.0.1

Formerly cdevienne/elm-orus-ui. Search finds this package by either name.

OUI.Menu

A general purpose menu

Types

type Item item
= Item item
| Divider

A menu item

Menu builders

new : (item -> String) -> Menu item msg

Creates a simple text menu

onClick : (item -> msg) -> Menu item msg -> Menu item msg

Set an event handler for when an item is clicked

withIcon : (item -> Maybe Icon) -> Menu item msg -> Menu item msg

Add leading icons to the menu

withTrailingIcon : (item -> Maybe Icon) -> Menu item msg -> Menu item msg

Add trailing icons to the menu

addItems : List item -> Menu item msg -> Menu item msg

Set the menu items

addDivider : Menu item msg -> Menu item msg

Add a divider the menu items

Internals

getItems : Menu item msg -> List (Item item)

get the items

getItemToText : Menu item msg -> item -> String

get the item to text function

getItemToIcon : Menu item msg -> item -> Maybe Icon

get the item to icon function

getItemToTrailingIcon : Menu item msg -> item -> Maybe Icon

get the item to trailing icon function

getItemSelected : Menu item msg -> item -> Bool

get the selected item

getOnClick : Menu item msg -> Maybe (item -> msg)

get the on click handler

getTextType : Menu item msg -> Type

get the text type

getTextSize : Menu item msg -> Size

get the text size