Module Fmlib_browser.Html

Virtual Dom

Primitives

type 'msg t

Type of a virtual dom node potentially generating a message of type 'msg.

val text : string -> 'msg t

text str Create a text node.

val node : string -> 'msg Attribute.t list -> 'msg t list -> 'msg t

node tag attrs children

Create an html element with a tagname, a list of attributes and a list of children.

val node_ns : string -> string -> 'msg Attribute.t list -> 'msg t list -> 'msg t

node namespace tag attrs children

Like node, but creates the node within a namespace e.g. "http://www.w3.org/2000/svg" for svg elements.

val svg_node : string -> 'msg Attribute.t list -> 'msg t list -> 'msg t

svg_node tag attrs children

Create an svg element with a tagname, a list of attributes and a list of children. An svg element is a node in the namespace "http://www.w3.org/2000/svg".

val map : ('a -> 'b) -> 'a t -> 'b t

map f vdom

Map a virtual dom vdom creating messages of type 'a to a virtual dom creating messages of type 'b.

val keyed : string -> 'msg Attribute.t list -> (string * 'msg t) list -> 'msg t

keyed tag attrs children

Like node, but add a unique identifier to each child node. This makes adding, removing and modifying child nodes more efficient. The dom diffing algorithm compares child nodes with the same identifier.

Headers

val h1 : 'msg Attribute.t list -> 'msg t list -> 'msg t

h1 attrs children is equivalent to node "h1" attrs children.

val h2 : 'msg Attribute.t list -> 'msg t list -> 'msg t

h2 attrs children is equivalent to node "h2" attrs children.

val h3 : 'msg Attribute.t list -> 'msg t list -> 'msg t

h3 attrs children is equivalent to node "h3" attrs children.

val h4 : 'msg Attribute.t list -> 'msg t list -> 'msg t

h4 attrs children is equivalent to node "h4" attrs children.

val h5 : 'msg Attribute.t list -> 'msg t list -> 'msg t

h5 attrs children is equivalent to node "h5" attrs children.

val h6 : 'msg Attribute.t list -> 'msg t list -> 'msg t

h6 attrs children is equivalent to node "h6" attrs children.

Grouping Content

val div : 'msg Attribute.t list -> 'msg t list -> 'msg t

div attrs children is equivalent to node "div" attrs children.

val span : 'msg Attribute.t list -> 'msg t list -> 'msg t

span attrs children is equivalent to node "span" attrs children.

val pre : 'msg Attribute.t list -> 'msg t list -> 'msg t

pre attrs children is equivalent to node "pre" attrs children.

val p : 'msg Attribute.t list -> 'msg t list -> 'msg t

p attrs children is equivalent to node "p" attrs children.

Input

val button : 'msg Attribute.t list -> 'msg t list -> 'msg t

button attrs children is equivalent to node "button" attrs children.

val input : 'msg Attribute.t list -> 'msg t list -> 'msg t

input attrs children is equivalent to node "input" attrs children.

val label : 'msg Attribute.t list -> 'msg t list -> 'msg t

label attrs children is equivalent to node "label" attrs children.

val textarea : 'msg Attribute.t list -> 'msg t list -> 'msg t

textarea attrs children is equivalent to node "textarea" attrs children.

val select : 'msg Attribute.t list -> 'msg t list -> 'msg t

select attrs children is equivalent to node "select" attrs children.

Lists

val ol : 'msg Attribute.t list -> 'msg t list -> 'msg t

ol attrs children is equivalent to node "ol" attrs children.

val ul : 'msg Attribute.t list -> 'msg t list -> 'msg t

ul attrs children is equivalent to node "ul" attrs children.

val li : 'msg Attribute.t list -> 'msg t list -> 'msg t

li attrs children is equivalent to node "li" attrs children.