Formerly cdevienne/elm-orus-ui. Search finds this package by either name.
A button+menu creation API
The button will open a menu when clicked.
Menu alignment
Keys
Creates a new button + menu
The button must not have any action defined on it
MenuButton.new (MenuButtonMsg "menu1")
OnMenu1Click
(Button.new "click me"
|> Button.outlinedButton
)
(Menu.new identity
|> Menu.withItems [ "One", "Two", "Three" ]
|> Menu.withIcon
(\i ->
if i /= "Two" then
Just OUI.Icon.check
else
Nothing
)
)
|> OUI.Material.menuButton shared.theme model.menu1State []Change the menu alignment to 'left' (default)
Change the menu alignment to 'right'
Change the menu alignment to 'top'
Change the menu alignment to 'bottom'
withOpenCloseIcons
Menu + button is a stateful component
The component state
The component message
Initialise the State. The given id must be unique in the currently displayed components
Catch clicks outside an opened menu
If you need to change the update effect into something else than Cmd (say, a
Effect, here is
everything you need.
Internal update returns Effect instead of Cmd
Do the update but returns a Effect instead of a Cmd
The Effect can be converted to a Cmd with performEffect
get the button
get the menu
get the menu alignment
get the keydown message
get the lose focus message
get the open/close icons
A Button + Menu component