Changes from V5:
These changes have required major API changes. Be sure to wire up subscriptions!
import Html.Styled exposing (..)
import Nri.Ui.Button.V9 as Button
import Nri.Ui.Modal.V6 as Modal
view : Modal.State -> Html Msg
view state =
Modal.info
{ title = { title = "Modal Header", visibleTitle = True }
, wrapMsg = ModalMsg
, content =
\{ onlyFocusableElement } ->
div []
[ Modal.viewContent [ text "Content goes here!" ]
, Modal.viewFooter
[ Button.button "Continue"
[ Button.primary
, Button.onClick DoSomthing
, Button.custom onlyFocusableElement
]
, text "`onlyFocusableElement` will trap the focus on the 'Continue' button."
]
]
}
state
subscriptions : Modal.State -> Sub Msg
subscriptions state =
Modal.subscriptions stateInclude 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.