arowM/elm-neat-layout/3.0.4

NOTE: the latest version is 4.0.5

Neat.Text

Module for inline texts. This module is for creating special texts. e.g., text that has links only to parts of it.

Core

type alias Text msg =
Text msg

Representing a text.

map : (a -> b) -> Text a -> Text b

Primitive constructors

fromString : String -> Text msg

Generate a Text with given text.

Attributes

setMixin : Mixin msg -> Text msg -> Text msg
setMixins : List (Mixin msg) -> Text msg -> Text msg
setAttribute : Attribute msg -> Text msg -> Text msg
setAttributes : List (Attribute msg) -> Text msg -> Text msg
setClass : String -> Text msg -> Text msg

Append class attribute.

setId : String -> Text msg -> Text msg

Append id attribute.

WAI-ARIA

setRole : String -> Text msg -> Text msg

Set "role" value for WAI-ARIA.

setAria : String -> String -> Text msg -> Text msg

Set "aria-*" value for WAI-ARIA.

e.g., setAria "required" "true" stands for "aria-required" is "true".

setBoolAria : String -> Bool -> Text msg -> Text msg

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"

Handle conditions

none : Text msg

Generate Nothing. It can be used to realize Texts only displayed under certain conditions, as shown below. In most cases, a function such as when will suffice, though.

fromTexts
    [ case mtext of
        Just t ->
            text t


        Nothing ->
            none
    ]
when : Bool -> Text msg -> Text msg
unless : Bool -> Text msg -> Text msg
withMaybe : Maybe a -> (a -> Text msg) -> Text msg

Lower level functions for HTML

setNodeName : String -> Text msg -> Text msg