Defines self-contained content that could exist independently of the rest of the content.
This file is organized roughly in order of popularity. The tags which you'd expect to use frequently will be closer to the top.
The core building block used to build up HTML. Here we create an
value with no attributes and one child:
hello : Html msg hello = div  [ text "Hello!" ]
Set attributes on your
Html. Learn more in the
Just put plain text in the DOM. It will escape the string so that it appears exactly as you specify.
text "Hello World!"
General way to create HTML nodes. It is used to define all of the helper functions in this library.
div : Array (Attribute msg) -> Array (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.
Transform the messages produced by some
Html. In the following example,
viewButton that produces
() messages, and we transform those values
Msg values in
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 ]
If you are growing your project as recommended in the official guide, this should not come in handy in most projects. Usually it is easier to just pass things in as arguments.
Note: Some folks have tried to use this to make “components” in their projects, but they run into the fact that components are objects. Both are local mutable state with methods. Gren is not an object-oriented language, so you run into all sorts of friction if you try to use it like one. I definitely recommend against going down that path! Instead, make the simplest function possible and repeat.
Represents a generic container with no special meaning.
Defines a portion that should be displayed as a paragraph.
Represents a thematic break between paragraphs of a section or article or any longer content.
Indicates that its content is preformatted and that this format must be preserved.
Represents a content that is quoted from another source.
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
Represents a hyperlink, linking to another resource.
Represents computer code.
Represents emphasized text, like a stress accent.
Represents especially important text.
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.
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.
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.
Represent a subscript.
Represent a superscript.
Represents a line break.
Defines an ordered list of items.
Defines an unordered list of items.
Defines a item of an enumeration list.
Defines a definition list, that is, a list of terms and their associated definitions.
Represents a term defined by the next
Represents the definition of the terms immediately listed before it.
Represents an image.
Embedded an HTML document.
Represents a bitmap area for graphics rendering.
Defines a mathematical formula.
Represents a form, consisting of controls, that can be submitted to a server for processing.
Represents a typed data field allowing the user to edit the data.
Represents a multiline text edit control.
Represents a control allowing selection among a set of options.
Represents an option in a
select element or a suggestion of a
Defines a section in a document.
Defines some content loosely related to the page content. If it is removed, the remaining content still makes sense.
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.
Defines a section containing contact information.
Defines the main or important content in the document. There is only one
main element in the document.
Represents a figure illustrated as part of the document.
Represents data with more than one dimension.
Represents a set of one or more columns of a table.
Represents a column of a table.
Represents the block of rows that describes the concrete data of a table.
Represents the block of rows that describes the column labels of a table.
Represents the block of rows that describes the column summaries of a table.
Represents a row of cells in a table.
Represents a data cell in a table.
Represents a header cell in a table.
Less Common Elements
Less Common Inputs
Represents a set of controls.
Represents the caption for a
Represents the caption of a form control.
Represents a set of predefined options for other controls.
Represents a set of options, logically grouped.
Represents the result of a calculation.
Represents the completion progress of a task.
Represents a scalar measurement (or a fractional value), within a known range.
Audio and Video
Represents a sound or audio stream.
Represents a video, the associated audio and captions, and controls.
Allows authors to specify alternative media resources for media elements
Allows authors to specify timed text track for media elements like
Represents a integration point for an external, often non-HTML, application or interactive content.
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.
Defines parameters for use by plug-ins invoked by
Defines an addition to the document.
Defines a removal from the document.
Represents a side comment, that is, text like a disclaimer or a copyright, which is not essential to the comprehension of the document.
Represents the title of a work.
Represents a term whose definition is contained in its nearest ancestor content.
Represents an abbreviation or an acronym; the expansion of the abbreviation can be represented in the title attribute.
Represents a date and time value; the machine-readable equivalent can be represented in the datetime attribute.
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.
Represents the output of a program or a computer.
Represents user input, often from the keyboard, but not necessarily; it may represent other input, like transcribed voice commands.
Represents content that is no longer accurate or relevant.
Represents an inline quotation.
Less Common Text Tags
Represents text highlighted for reference purposes, that is for its relevance in another context.
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.
Represents the text of a ruby annotation.
Represents parenthesis around a ruby annotation, used to display the annotation in an alternate way by browsers not supporting the standard display for annotations.
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.
Represents the directionality of its children, in order to explicitly override the Unicode bidirectional algorithm.
Represents a line break opportunity, that is a suggested point for wrapping text in order to improve readability of text split on several lines.
Represents a widget from which the user can obtain additional information or controls.
Represents a summary, caption, or legend for a given