arowM/elm-neat-layout/1.0.2

NOTE: the latest version is 4.0.5

Neat.Layout.Row

Row

rowWith : Row -> List (View p msg) -> View p msg
type alias Row =
{ vertical : Vertical
, horizontal : Horizontal
, wrap : Bool
, nodeName : String
}

Configuration about row alignment.

Default Row configuration.

{ vertical = Top
, horizontal = Left
, wrap = False
, nodeName = "div"
}
row : List (View p msg) -> View p msg

An alias for rowWith defaultRow.

= Top
| Bottom
| VCenter
| Stretch
= Left
| Right
| HCenter
| SpaceBetween
| SpaceAround

Optimization

(x -> String)
-> (x -> Vertical -> Html (Protected p msg))
-> Row
-> List x
-> View p msg

Optimized row.

  • First argument: identifier for each element

    • the return value must be unique among all elements
  • Second argument: apply lazyN on the resulting function of toProtected.

v1 : View p msg
v1 =
    Debug.todo "v1"

v2 : View p msg
v2 =
    Debug.todo "v2"

child : Int -> View p msg
child _ =
    Debug.todo "child"

-- Make sure to declare this top level in order to `lazy` works well.
child_ : Int -> Vertical -> Html (Protected p msg)
child_ n =
    toProtected <| child n

v : List Int -> View p msg
v =
    optimized
        String.fromInt
        (\n -> lazy2 child_ n)
        defaultRow
toProtected : View p a -> Vertical -> Html (Protected p a)

This is supposed to be used in order to make Html.lazy.lazyN work. See optimized for real usage.