mbr/elm-chadcn/1.0.0

ChadCn.AlertDialog

Provides a controlled alert dialog.

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

type Config msg

Describes an alert dialog and its responses.

type Msg

Describes events handled by an alert dialog.

type Size
= Default
| Small

Controls the alert dialog's constrained width.

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

Creates an alert dialog configuration with an accessible title and cancellation response.

withAction : msg -> List (Html msg) -> Config msg -> Config msg

Sets the primary response and its message.

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

Adds native attributes to the primary response.

withActionDisabled : Bool -> Config msg -> Config msg

Sets whether the primary response accepts interaction.

Sets the primary response's button variant.

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

Adds native attributes to the cancellation response.

withCancelContent : List (Html msg) -> Config msg -> Config msg

Replaces the cancellation response's content.

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

Sets additional content between the heading and responses.

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

Adds native attributes to the alert dialog popup.

withDescription : List (Html msg) -> Config msg -> Config msg

Sets supporting alert dialog text.

withInitialFocusId : String -> Config msg -> Config msg

Sets the element focused when the alert dialog is rendered.

withMedia : List (Html msg) -> Config msg -> Config msg

Sets media rendered with the alert dialog heading.

withSize : Size -> Config msg -> Config msg

Sets the alert dialog's constrained width.

focusInitial : Config msg -> Cmd msg

Moves focus to the alert dialog's safe response.

subscriptions : Config msg -> Sub msg

Subscribes to keyboard cancellation.

update : Config msg -> Msg -> Cmd msg

Applies an alert dialog event.

view : Config msg -> Html msg

Renders the alert dialog.