tesk9/modal/1.0.0

NOTE: the latest version is 7.0.0

Modal

import Html exposing (..)
import Html.Attributes exposing (style)
import Modal


view modalState =
    Modal.view
        { ifClosed =
            button (Modal.openOnClick "intro-modal")
                [ text "Launch intro modal" ]
        , overlayColor = "rgba(128, 0, 128, 0.7)"
        , modalContainer =
            div
                [ style "background-color" "white"
                , style "border-radius" "4px"
                , style "border" "2px solid purple"
                , style "margin" "40px auto"
                , style "padding" "20px"
                , style "max-width" "600px"
                , style "min-height" "40vh"
                ]
        , title = ( "Intro Modal", [] )
        , content =
            div
                [ style "display" "flex"
                ]
                [ text "Welcome to this modal! I'm so happy to have you here with me."
                , button
                    (Modal.closeOnClick :: Modal.singleFocusableElement)
                    [ text "Close intro modal" ]
                ]
        }
        modalState
type Model
type Msg
update : Msg -> Model -> ( Model, Cmd Msg )
{ ifClosed : Html msg
, overlayColor : String
, modalContainer : List (Html msg) -> Html msg
, title : ( String, List (Attribute Never) )
, content : Html msg
}
-> Model
-> Html msg
openOnClick : String -> List (Attribute Msg)
closeOnClick : Attribute Msg
firstFocusableElement : List (Attribute Msg)
lastFocusableElement : List (Attribute Msg)
singleFocusableElement : List (Attribute Msg)