Main module for elm-neat-layout.
Primitive type representing no gap
For custom gaps, see Custom gaps.
Browser.* alternativesAlternative to Browser.sandbox.
This inserts following CSS.
<style>
*,
*::before,
*::after {
box-sizing: border-box;
}
[data-elm-neat-layout~=flex] {
display:-ms-flexbox;
display:flex
}
</style>Settings for rendering View.
The baseGapSize is base gap size in <length> CSS data type.
All gap sizes are determined relative to this value.
e.g., "16px", "1.2rem", ...
The "em" unit is not recommended because it varies with parent node font-size of each gap.
defaultRenderer =
{ baseGapSize = "1rem"
}Alternative to Browser.element.
This also inserts following style tag.
<style>
*,
*::before,
*::after {
box-sizing: border-box;
}
[data-elm-neat-layout~=flex] {
display:-ms-flexbox;
display:flex
}
</style>Alternative to Browser.document.
This also inserts following style tag.
<style>
*,
*::before,
*::after {
box-sizing: border-box;
}
[data-elm-neat-layout~=flex] {
display:-ms-flexbox;
display:flex
}
</style>Alternative to Browser.Document.
Alternative to Browser.application.
This also inserts following style tag.
<style>
*,
*::before,
*::after {
box-sizing: border-box;
}
[data-elm-neat-layout~=flex]{
display:-ms-flexbox;
display:flex
}
</style>Lift Html nodes into View.
import Html exposing (div)
import Mixin exposing (Mixin)
import Neat exposing (View)
import Neat.Gap as Gap exposing (NoGap)
view1 : View NoGap msg
view1 =
Neat.div
[]
[ Neat.text "view1"
]
view2 : View NoGap msg
view2 =
Neat.div
[]
[ Neat.text "view2"
]
composed : View NoGap msg
composed =
lift div
[ Mixin.class "parent"
]
[ view1
, view2
]Create a text block.
textBlock "foo" is equivalent to Html.div [] [ Html.text "foo" ] in Html world.
textBlock =
textNode Html.divCreate a View which only contains a text node.
textNode Html.option "Item1" is equivalent to Html.option [] [ Html.text "Item1" ] in Html world.
View version of Html.text "".
An alias for \node -> lift node [] [].
View version of Html.input.
Differ from lift Html.input [] [], it can accept "padding" style property.
View version of Html.textarea.
Differ from lift Html.textarea [] [], it can accept "padding" style property.
View version of Html.select.
Differ from lift Html.select, it can accept "padding" style property.
Insert a View only when a condition is met.
Insert a View unless a condition is met.
You can use custom gaps just by declaring their types and IsGap values.
e.g.,
module MyGap exposing
( ButtonGroup
, buttonGroup
)
import Neat exposing (IsGap)
type ButtonGroup
= ButtonGroup
buttonGroup : IsGap ButtonGroup
buttonGroup =
IsGap
{ width = 0.6
, height = 0.6
}Information about your custom gaps.
baseGapSize of RendererbaseGapSize of RendererThe Renderer value above is given to sandbox, element, document, application.
e.g., When baseGapSize = "2rem" is passed to sandbox, IsGap { width = 1.2, height = 2 } becomes gap with "2.4rem" width and "4rem" height.
Expand gap from g1 to g2.
Both the width and the height of g2 is supposed to be greater than g1.
Wrap a view with boundary without gap.
Alias for setBoundary defaultBoundary.
Set boundary to convert into NoGap.
Alias for setBoundaryWithMap identity.
Set boundary to convert into NoGap.
In addition, setBoundaryWithMap can convert msg type of a View.
(The elm-neat-layout does not have map function. Use setBoundaryWithMap, Layout.Row.rowWithMap, and Layout.Column.columnWithMap, instead.)
Set "role" value for WAI-ARIA.
Set "aria-*" value for WAI-ARIA.
e.g., setAria "required" "true" stands for "aria-required" is "true".
Set boolean "aria-*" value for WAI-ARIA.
i.e.,
setBoolAria name True is equal to setAria name "true"setBoolAria name False is equal to setAria name "false"These are lower level functions, so all you need would be Neat.Layout.Row.optimized and Neat.Layout.Column.optimized.
Do not worry even if you cannot understand how to use these functions.
v1 : View g msg
v1 =
Debug.todo "v1"
v2 : View g msg
v2 =
Debug.todo "v2"
child : Int -> View g msg
child _ =
Debug.todo "child"
child_ : Int -> Html (Protected g msg)
child_ =
toProtected << child
v : List Int -> View g msg
v =
optimized
String.fromInt
(lazy child_)
"div"
[]This is supposed to be used in order to make Html.Lazy.lazyN work.
See optimized for real usage.
Html alternative type.