arowM/elm-neat-layout/2.0.0

NOTE: the latest version is 4.0.5

Neat.Layout.Row

Row

rowWith : Row -> List (View p msg) -> View p msg

Align Views horizontally.

Alias for rowWithMap.

rowWithMap : (a -> b) -> Row -> List (View p a) -> View p b

Align Views horizontally. In addition, rowWithMap can convert msg type of a View.

type alias Row =
{ vertical : Vertical
, horizontal : Horizontal
, wrap : Wrap
, nodeName : String
}

Configuration about row alignment.

type Wrap
= NoWrap
| Wrap
| WrapInto Int

Configuration about wrapping.

Default Row configuration.

{ vertical = Stretch
, horizontal = Left
, wrap = NoWrap
, 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 -> Row -> Renderer -> 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 -> Row -> Renderer -> 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 -> Row -> Renderer -> Html (Protected p a)

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