package virtual_dom

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
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 suppress_merge_warnings : t -> t

This function does not affect hooks, styles, classes, or on_* handlers, since warnings due to merging those can be avoided. It allows disabling warnings for attributes that are unmergeable. Note that no merging behavior is changed by this function - it only changes whether warnings are emitted.

Example: If href is already on a node, then adding a suppress_merge_warning (href input) attribute to the node will not trigger a warning. However, adding another href which does not use suppress_merge_warnings to the node will again emit a warning. In other words, this function only suppresses warnings for an instance of an attribute, not all attributes of the same type. *

val create_hook : string -> Virtual_dom__.Hooks.t -> t

create_hook name hook creates a hook attribute with a name

val many : t list -> t

many merges several attributes into one. It merges hooks, on_* event handlers, classes, and styles.

  • Hooks get merged via their Input.combine function
  • All handlers get runin the order they appear
  • The set of classes is unioned
  • Styles are merged via concatenation
val many_without_merge : t list -> t
val empty : t

Equivalent to many []. It adds no attributes to the DOM.

val (@) : t -> t -> t

Equivalent to combine

val combine : t -> t -> t

Equivalent to many [x; y]

val autofocus : bool -> t
val checked : t
val class_ : string -> t
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 target : string -> t
val id : string -> t
val name : string -> t
val placeholder : string -> t
val selected : t
val hidden : t
val readonly : t
val style : Css_gen.t -> t
val min : float -> t
val max : float -> t
val colspan : int -> t
val rowspan : int -> t
val draggable : bool -> t
val tabindex : int -> t
val type_ : string -> t
val value : string -> t
val value_prop : string -> t
val title : string -> t
val src : string -> t
module Unmerged_warning_mode : sig ... end
val to_raw : t -> Ojs.t
val on_input : (Js_of_ocaml.Dom_html.event Js_of_ocaml.Js.t -> string -> unit Ui_effect.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 -> unit Ui_effect.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

on_file_input is like on_input but for file picker input elements (i.e. type=file). Instead of passing the value of the input as a string, the list of selected files is passed.

See Vdom_input_widgets.File_select, or, if you are a bonsai user, Bonsai_web_ui_form.Elements.File_select, for a convenient API that wraps this.

module Multi : sig ... end

A collection of CSS attributes.

module Always_focus_hook : sig ... end
module Single_focus_hook () : sig ... end
module Expert : sig ... end
module Hooks : sig ... end
module Global_listeners : sig ... end

Hooks to set mouse events listeners on window. This is needed as if we only set them on individual elements we will miss ones that happen outside of the viewport

OCaml

Innovation. Community. Security.