mbr/elm-chadcn/1.0.0

ChadCn.Dialog

Provides a controlled dialog.

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

type Config msg

Describes a dialog and its contents.

type Model

Holds dialog interaction state.

type Msg

Describes messages handled by a dialog.

init : String -> Model

Creates closed dialog state with a stable DOM identifier.

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

Creates a dialog configuration with an accessible title.

withCloseButton : Bool -> Config msg -> Config msg

Controls whether the dialog renders its close control.

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

Sets the dialog's caller-owned content.

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

Adds native attributes to the dialog popup.

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

Sets supporting dialog text.

withInitialFocusId : String -> Config msg -> Config msg

Sets the element focused when the dialog opens.

withOnClose : msg -> Config msg -> Config msg

Sets the message emitted after the dialog closes.

withRestoreFocusId : String -> Config msg -> Config msg

Sets the element focused after the dialog closes.

Controls whether the dialog header is only exposed to assistive technology.

open : Config msg -> Model -> ( Model, Cmd msg )

Opens the dialog and moves focus into it.

close : Config msg -> Model -> ( Model, Cmd msg )

Closes the dialog immediately.

isOpen : Model -> Bool

Returns whether the dialog is open.

subscriptions : Config msg -> Model -> Sub msg

Subscribes to document-level dismissal while the dialog is open.

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

Applies a dialog message.

view : Model -> Config msg -> Html msg

Renders a configured dialog.