Configure alert to use primary colors.
Renamed to aDifferentJT/elm-bootstrap. That is where the repository lives now. It has not been published as a package under the new name.
Versions published as nixCodeX/elm-bootstrap still install under that name. 13 versions of 13 come from the new location (see their notes).
Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/aDifferentJT/elm-bootstrap.
What we checked: The repo moved to github.com/aDifferentJT/elm-bootstrap. Rebuilt with git archive from commit 1b8076a95135 of https://github.com/aDifferentJT/elm-bootstrap (zip prefix nixCodeX-elm-bootstrap-1b8076a/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 f847da7d5ddb22fe6d0233a78d17c8dc566dda5c.
The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.
Details · package.elm-lang.org's zip: https://github.com/nixCodeX/elm-bootstrap/zipball/2.0.6/
Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.
When you just need a simple alert, these shorthand functions lets you quickly display an alert.
simplePrimary [] [ text "I'm a simple alert!" ]
simpleWarning
[ class "myCustomAlertClass" ]
[ Alert.h1 [] [ text "Alert heading" ]
, p [] [ text "Some alert content." ]
, Alert.link [ href "#somewhere" ] [ text "Styled link" ]
]Show an elert using secondary color.
attributes - List of attributes to customize the alert containerchildren - List of child html elementsShow an elert using success color.
attributes - List of attributes to customize the alert containerchildren - List of child html elementsShow an elert using info color.
attributes - List of attributes to customize the alert containerchildren - List of child html elementsShow an elert using warning color.
attributes - List of attributes to customize the alert containerchildren - List of child html elementsShow an elert using danger color.
attributes - List of attributes to customize the alert containerchildren - List of child html elementsShow an elert using light color.
attributes - List of attributes to customize the alert containerchildren - List of child html elementsShow an elert using dark color.
attributes - List of attributes to customize the alert containerchildren - List of child html elementsThese functions allow you to create alert children with alert specific styling
To get proper link colors for a elements use this function
attributes List of attributes for the link elementchildren List of child elementsAlert h1 header with appropriate color styling
attributes List of attributeschildren List of child elementsAlert h2 header with appropriate color styling
attributes List of attributeschildren_ List of child elementsAlert h3 header with appropriate color styling
attributes List of attributeschildren_ List of child elementsAlert h3 header with appropriate color styling
attributes List of attributeschildren_ List of child elementsAlert h5 header with appropriate color styling
attributes List of attributeschildren_ List of child elementsAlert h6 header with appropriate color styling
attributes List of attributeschildren_ List of child elementsDismissable alerts are also supported. You can even configure them to have a fade out animation when dismissed. Unlike it's Twitter Bootstrap JavaScript counterpart we can't remove the alert element from the DOM. It's simply set to display:none. To support dismissable alerts you must keep track of the alerts visibility in your model.
type alias Model =
{ alertVisibility : Alert.Visibility }
type Msg
= AlertMsg Alert.Visibility
init : ( Model, Cmd Msg )
init =
( { alertVisibility = Alert.shown }
, Cmd.none
)
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
AlertMsg visibility ->
( { model | alertVisibility = visibility }, Cmd.none )
view : Model -> Html Msg
view model =
Alert.config
|> Alert.dismissableWithAnimation AlertMsg
|> Alert.info
|> Alert.children
[ Alert.h4 [] [ text "Alert heading" ]
, Alert.text "This info message has a "
, Alert.link [ href "javascript:void()" ] [ text "link" ]
, Alert.p [] [ text "Followed by a paragraph behaving as you'd expect." ]
]
|> Alert.view model.alertVisibility
-- Subscriptions are only needed when you choose to use dismissableWithAnimation
subscriptions : Model -> Sub Msg
subscriptions model =
Alert.subscriptions model.alertVisibility AlertMsgCall the view function to turn an alert config into an Elm Html element.
visibility The current visibility for the alert.config Configuration settings and child elements for your alert.Opaque type used for describing the configuration of an alert.
Use this function to represent the shown state for an alert.
Use this function to represent the closed/dismissed state for an alert.
Opaque type used to represent whether to display the alert or not.
Make the alert dismissable. Adds a close icon top right. You'll need to handle the msg in your update function.
type Msg
= AlertMsg Alert.Visibilty
-- somewhere in your view function where you display the alert
Alert.config
|> Alert.dismissable AlertMsg
|> ... etcEnable a fade out animation when closing/dismissing an Alert.
Subscription for handling animations. Don't forget this when configuring your alert to be dismissable with animation.
subscriptions : Model -> Sub Msg
subscriptions model =
Alert.subscriptions model.alertVisibility AlertMsg
Show an elert using primary color.
attributes- List of attributes to customize the alert containerchildren- List of child html elements