Changes from V7:
import Html.Styled exposing (..)
import Nri.Ui.Button.V10 as Button
import Nri.Ui.Modal.V8 as Modal
type Msg
= ModalMsg Modal.Msg
| DoSomething
view : Modal.Model -> Html Msg
view state =
Modal.info
{ title = "Modal Header"
, wrapMsg = ModalMsg
, visibleTitle = True
}
(\{viewContent, closeButton} ->
Modal.onlyFocusableElementView
(\{ onlyFocusableElement } ->
div []
[ viewContent {
, content = [ text "Content goes here!" ]
, footer =
[ Button.button "Continue"
[ Button.primary
, Button.onClick DoSomething
, Button.custom onlyFocusableElement
]
, text "`onlyFocusableElement` will trap the focus on the 'Continue' button."
]
}
visibleTitle
]
)
)
state
subscriptions : Modal.Model -> Sub Msg
subscriptions state =
Modal.subscriptions state
view init
--> text "" -- a closed modalInclude the subscription if you want the modal to dismiss on Esc.
Pass the id of the element that focus should return to when the modal closes.