avarda-ab/avarda-ui/2.5.0

NOTE: the latest version is 5.0.3

AvardaUi.Util.Builder

Helpers for building components with the Elm builder pattern.

These functions make it easier to conditionally apply configuration when constructing UI components.

withMaybeBuilder : (prop -> builder -> builder) -> Maybe prop -> builder -> builder

Apply a builder function if there is a Just value. If the value is Nothing, the builder is skipped.

Input.new "username" {...}
    |> BuilderUtil.withMaybeBuilder Input.withPlaceholder (Just "Enter username")
    |> Input.view
withConditionalBuilder : (builder -> builder) -> Bool -> builder -> builder

Apply a builder function only if a condition is True. If the condition is False, the builder is skipped.

Input.new "username" {...}
    |> BuilderUtil.withConditionalBuilder (Input.withLeftChild iconView) shouldShowLeftIcon
    |> Input.view