bluedogtraining / bdt-elm / Html.Styled.Bdt

Helpers on top of Html.Styled to show/hide things

Show/Hide Elements

attributeIf : Basics.Bool -> Html.Styled.Attribute msg -> Html.Styled.Attribute msg

Optionally add an attribute.

button
    [ onClick MyMessage |> attributeIf model.isButtonEnabled ]
    [ text "Clickety Click" ]

maybeAttribute : (a -> Html.Styled.Attribute msg) -> Maybe a -> Html.Styled.Attribute msg

Maybe add an attribute.

button
    [ maybeAttribute onClick model.myMaybeMsg ]
    [ text "Clickety Click" ]

viewIf : Basics.Bool -> Html.Styled.Html msg -> Html.Styled.Html msg

Only display if True.

viewIf model.isShown myViewFunction

divIf : Basics.Bool -> List (Html.Styled.Attribute msg) -> List (Html.Styled.Html msg) -> Html.Styled.Html msg

Only display if True.

divIf model.isShown
    [ id "potato" ]
    [ text "Hello" ]

maybeView : Maybe a -> (a -> Html.Styled.Html msg) -> Html.Styled.Html msg

Maybe display a view.

maybeView view model.myMaybe