mbr/elm-chadcn/1.0.0

ChadCn.Command

Provides a command menu.

The implementation follows the shadcn Base UI structure and Nova defaults.

type Config msg

Describes a command menu and its caller-owned content.

type Entry msg

Describes one command-list element.

type Item msg

Describes one selectable command.

type Model

Holds the highlighted command item.

type Msg

Describes command interactions.

Creates command state without a highlighted item.

new : String -> (Msg -> msg) -> (String -> msg) -> Config msg

Creates a command menu with a controlled input.

withAttributes : List (Attribute msg) -> Config msg -> Config msg

Adds native attributes to the command root.

withContent : List (Entry msg) -> Config msg -> Config msg

Sets the caller-owned command-list content.

withInputAttributes : List (Attribute msg) -> Config msg -> Config msg

Adds native attributes to the command input.

withInputPlaceholder : String -> Config msg -> Config msg

Sets the command input placeholder.

withInputValue : String -> Config msg -> Config msg

Sets the controlled command input value.

withListAttributes : List (Attribute msg) -> Config msg -> Config msg

Adds native attributes to the command list.

update : Config msg -> Msg -> Model -> ( Model, Cmd msg )

Applies a command interaction.

view : Model -> Config msg -> Html msg

Renders a configured command menu.

Highlights the first enabled command item.

newItem : String -> String -> msg -> List (Html msg) -> Item msg

Creates an enabled command item.

withItemAttributes : List (Attribute msg) -> Item msg -> Item msg

Adds native attributes to a command item.

withItemChecked : Bool -> Item msg -> Item msg

Controls whether a command item displays its checked state.

withItemDisabled : Bool -> Item msg -> Item msg

Controls whether a command item accepts interaction.

item : Item msg -> Entry msg

Adds a command item to declarative list content.

empty : List (Attribute msg) -> List (Html msg) -> Entry msg

Creates command empty-state content.

List (Attribute msg)
-> List (Html msg)
-> List (Item msg)
-> Entry msg

Creates a labeled group of command items.

separator : List (Attribute msg) -> Entry msg

Creates a command-list separator.

shortcut : List (Attribute msg) -> List (Html msg) -> Html msg

Renders trailing shortcut text.

dialog : Model -> Config msg -> Model -> Config msg -> Html msg

Renders a command menu inside a configured dialog.