miyamoen / elm-command-pallet / CommandPallet

A command pallet component.

Model


type Model msg

Contains a current state for a command pallet.

init : (Msg -> msg) -> List ( String, msg ) -> Model msg

Accepts Msg converter function and your commands.

CommandPallet.init CommandPalletMsg
    [ ( "Increment", Increment )
    , ( "Decrement", Decrement )
    , ( "1", Set 1 )
    , ( "11", Set 11 )
    , ( "123", Set 123 )
    , ( "151", Set 151 )
    , ( "100", Set 100 )
    , ( "101", Set 101 )
    , ( "900", Set 900 )
    ]

View

inFront : Model msg -> Element.Attribute msg

Attribute in elm-ui.

Use like below:

layout [ CommandPallet.inFront model.commandPallet ] <|
    column [] [ text "your application..." ]

html : Model msg -> Html msg

View function with Html

Update


type alias Msg =
Types.Msg

Needs to be passed to update.

update : Msg -> Model msg -> ( Model msg, Platform.Cmd.Cmd msg )

Returns a new Model and a parent Cmd msg.

Startup

subscriptions : Model msg -> Platform.Sub.Sub msg

Subsciption for startup key, p.

subscriptionsWithKey : Keyboard.Key.Key -> Model msg -> Platform.Sub.Sub msg

Customizable subsciption for startup key.

Key type is in SwiftsNamesake/proper-keyboard.

showUpMsg : Msg

Use showUpMsg in your application and customize command pallet startup.