miniBill / elm-html-with-context / Html.WithContext

htmlAttribute : Html.Attribute msg -> Attribute context msg

Turn an Attribute msg from elm/html into an Attribute context msg from elm-html-with-context

html : Html msg -> Html context msg

Turn an Html msg from elm/html into an Html context msg from elm-html-with-context

withContextAttribute : (context -> Attribute context msg) -> Attribute context msg

Use the context passed in to create an Attribute

withContext : (context -> Html context msg) -> Html context msg

Use the context passed in to create an Html node

toHtml : context -> Html context msg -> Html msg

Turn an Html context msg from elm-html-with-context into an Html msg from elm/html

menu : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a list of commands.

menuitem : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a command that the user can invoke.

summary : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a summary, caption, or legend for a given details.

details : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a widget from which the user can obtain additional information or controls.

meter : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a scalar measurement (or a fractional value), within a known range.

progress : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the completion progress of a task.

output : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the result of a calculation.

textarea : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a multiline text edit control.

option : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents an option in a select element or a suggestion of a datalist element.

optgroup : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a set of options, logically grouped.

datalist : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a set of predefined options for other controls.

select : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a control allowing selection among a set of options.

button : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a button.

input : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a typed data field allowing the user to edit the data.

label : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the caption of a form control.

legend : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the caption for a fieldset.

fieldset : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a set of controls.

form : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a form, consisting of controls, that can be submitted to a server for processing.

th : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a header cell in a table.

td : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a data cell in a table.

tr : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a row of cells in a table.

tfoot : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the block of rows that describes the column summaries of a table.

thead : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the block of rows that describes the column labels of a table.

tbody : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the block of rows that describes the concrete data of a table.

col : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a column of a table.

colgroup : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a set of one or more columns of a table.

caption : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the title of a table.

table : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents data with more than one dimension.

math : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines a mathematical formula.

canvas : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a bitmap area for graphics rendering.

track : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Allows authors to specify timed text track for media elements like video or audio.

source : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Allows authors to specify alternative media resources for media elements like video or audio.

audio : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a sound or audio stream.

video : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a video, the associated audio and captions, and controls.

param : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines parameters for use by plug-ins invoked by object elements.

object : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents an external resource, which is treated as an image, an HTML sub-document, or an external resource to be processed by a plug-in.

embed : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a integration point for an external, often non-HTML, application or interactive content.

iframe : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Embedded an HTML document.

img : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents an image.

del : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines a removal from the document.

ins : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines an addition to the document.

wbr : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a line break opportunity, that is a suggested point for wrapping text in order to improve readability of text split on several lines.

br : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a line break.

span : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents text with no specific meaning. This has to be used when no other text-semantic element conveys an adequate meaning, which, in this case, is often brought by global attributes like class, lang, or dir.

bdo : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the directionality of its children, in order to explicitly override the Unicode bidirectional algorithm.

bdi : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents text that must be isolated from its surrounding for bidirectional text formatting. It allows embedding a span of text with a different, or unknown, directionality.

rp : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents parenthesis around a ruby annotation, used to display the annotation in an alternate way by browsers not supporting the standard display for annotations.

rt : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the text of a ruby annotation.

ruby : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents content to be marked with ruby annotations, short runs of text presented alongside the text. This is often used in conjunction with East Asian language where the annotations act as a guide for pronunciation, like the Japanese furigana.

mark : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents text highlighted for reference purposes, that is for its relevance in another context.

u : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a non-textual annotation for which the conventional presentation is underlining, such labeling the text as being misspelt or labeling a proper name in Chinese text.

b : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a text which to which attention is drawn for utilitarian purposes. It doesn't convey extra importance and doesn't imply an alternate voice.

i : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents some text in an alternate voice or mood, or at least of different quality, such as a taxonomic designation, a technical term, an idiomatic phrase, a thought, or a ship name.

sup : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represent a superscript.

sub : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represent a subscript.

kbd : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents user input, often from the keyboard, but not necessarily; it may represent other input, like transcribed voice commands.

samp : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the output of a program or a computer.

var : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a variable. Specific cases where it should be used include an actual mathematical expression or programming context, an identifier representing a constant, a symbol identifying a physical quantity, a function parameter, or a mere placeholder in prose.

code : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents computer code.

time : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a date and time value; the machine-readable equivalent can be represented in the datetime attribute.

abbr : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents an abbreviation or an acronym; the expansion of the abbreviation can be represented in the title attribute.

dfn : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a term whose definition is contained in its nearest ancestor content.

q : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents an inline quotation.

cite : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the title of a work.

s : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents content that is no longer accurate or relevant.

small : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a side comment, that is, text like a disclaimer or a copyright, which is not essential to the comprehension of the document.

strong : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents especially important text.

em : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents emphasized text, like a stress accent.

a : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a hyperlink, linking to another resource.

div : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a generic container with no special meaning.

figcaption : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the legend of a figure.

figure : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a figure illustrated as part of the document.

dd : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents the definition of the terms immediately listed before it.

dt : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a term defined by the next dd.

dl : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines a definition list, that is, a list of terms and their associated definitions.

li : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines a item of an enumeration list.

ul : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines an unordered list of items.

ol : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines an ordered list of items.

blockquote : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a content that is quoted from another source.

pre : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Indicates that its content is preformatted and that this format must be preserved.

hr : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Represents a thematic break between paragraphs of a section or article or any longer content.

p : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines a portion that should be displayed as a paragraph.

main_ : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines the main or important content in the document. There is only one main element in the document.

address : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines a section containing contact information.

footer : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines the footer for a page or section. It often contains a copyright notice, some links to legal information, or addresses to give feedback.

header : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines the header of a page or section. It often contains a logo, the title of the web site, and a navigational table of content.

h6 : List (Attribute context msg) -> List (Html context msg) -> Html context msg

h5 : List (Attribute context msg) -> List (Html context msg) -> Html context msg

h4 : List (Attribute context msg) -> List (Html context msg) -> Html context msg

h3 : List (Attribute context msg) -> List (Html context msg) -> Html context msg

h2 : List (Attribute context msg) -> List (Html context msg) -> Html context msg

h1 : List (Attribute context msg) -> List (Html context msg) -> Html context msg

aside : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines some content loosely related to the page content. If it is removed, the remaining content still makes sense.

article : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines self-contained content that could exist independently of the rest of the content.

nav : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines a section that contains only navigation links.

section : List (Attribute context msg) -> List (Html context msg) -> Html context msg

Defines a section in a document.

map : (a -> b) -> Html context a -> Html context b

Transform the messages produced by some Html. In the following example, we have viewButton that produces () messages, and we transform those values into Msg values in view.

type Msg = Left | Right

view : model -> Html Msg
view model =
  div []
    [ map (\_ -> Left) (viewButton "Left")
    , map (\_ -> Right) (viewButton "Right")
    ]

viewButton : String -> Html ()
viewButton name =
  button [ onClick () ] [ text name ]

This should not come in handy too often. Definitely read this before deciding if this is what you want.

text : String -> Html context msg

Just put plain text in the DOM. It will escape the string so that it appears exactly as you specify.

text "Hello World!"

node : String -> List (Attribute context msg) -> List (Html context msg) -> Html context msg

General way to create HTML nodes. It is used to define all of the helper functions in this library.

div : List (Attribute msg) -> List (Html msg) -> Html msg
div attributes children =
    node "div" attributes children

You can use this to create custom nodes if you need to create something that is not covered by the helper functions in this library.


type alias Attribute context msg =
Internal.Attribute context msg

Set attributes on your Html. Learn more in the Html.Attributes module.


type alias Html context msg =
Internal.Html context msg

The core building block used to build up HTML. Here we create an Html value with no attributes and one child:

hello : Html msg
hello =
  div [] [ text "Hello!" ]