package virtual_dom

  1. Overview
  2. Docs
type t

This type covers both properties and attributes, despite the name.

val create : string -> string -> t

create name value creates a simple string-only attribute

val create_float : string -> float -> t

create_float name float creates a simple float-only attribute

val string_property : string -> string -> t

string_property name value creates a simple string-only property

val bool_property : string -> bool -> t

bool_property name value creates a simple bool-only property

val property : string -> Js_of_ocaml.Js.Unsafe.any -> t

property name value creates a property with a generic value

val on : string -> (Js_of_ocaml.Dom_html.event Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val autofocus : bool -> t
val checked : t
val class_ : string -> t
val to_class : t -> Base.Set.M(Base.String).t option
val classes : string list -> t
val classes' : Base.Set.M(Base.String).t -> t
val disabled : t
val for_ : string -> t
val href : string -> t
val id : string -> t
val name : string -> t
val placeholder : string -> t
val selected : t
val hidden : t
val style : Css_gen.t -> t
val to_style : t -> Css_gen.t option

to_style (style c) = Some c, None otherwise

val tabindex : int -> t
val type_ : string -> t
val value : string -> t
val on_focus : (Js_of_ocaml.Dom_html.event Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_blur : (Js_of_ocaml.Dom_html.event Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_input : (Js_of_ocaml.Dom_html.event Js_of_ocaml.Js.t -> string -> Virtual_dom__.Event.t) -> t

on_input fires every time the input changes, i.e., whenever a key is pressed in the input field. The current contents are returned as an OCaml string as a convenience

val on_change : (Js_of_ocaml.Dom_html.event Js_of_ocaml.Js.t -> string -> Virtual_dom__.Event.t) -> t

on_change fires when the input is complete, i.e., when enter is pressed in the input field or the input field loses focus. The current contents are returned as an OCaml string as a convenience

val on_click : (Js_of_ocaml.Dom_html.mouseEvent Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_contextmenu : (Js_of_ocaml.Dom_html.mouseEvent Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_double_click : (Js_of_ocaml.Dom_html.mouseEvent Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_mousemove : (Js_of_ocaml.Dom_html.mouseEvent Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_mouseup : (Js_of_ocaml.Dom_html.mouseEvent Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_mousedown : (Js_of_ocaml.Dom_html.mouseEvent Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_mouseenter : (Js_of_ocaml.Dom_html.mouseEvent Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_mouseleave : (Js_of_ocaml.Dom_html.mouseEvent Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_mouseover : (Js_of_ocaml.Dom_html.mouseEvent Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_mouseout : (Js_of_ocaml.Dom_html.mouseEvent Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_keyup : (Js_of_ocaml.Dom_html.keyboardEvent Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_keypress : (Js_of_ocaml.Dom_html.keyboardEvent Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t
val on_keydown : (Js_of_ocaml.Dom_html.keyboardEvent Js_of_ocaml.Js.t -> Virtual_dom__.Event.t) -> t