package virtual_dom

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Vdom.AttrSource

Sourcetype t

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

Sourceval create : string -> string -> t

create name value creates a simple string-only attribute

Sourceval create_float : string -> float -> t

create_float name float creates a simple float-only attribute

Sourceval string_property : string -> string -> t

string_property name value creates a simple string-only property

Sourceval bool_property : string -> bool -> t

bool_property name value creates a simple bool-only property

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

property name value creates a property with a generic value

Sourceval 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. *

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

create_hook name hook creates a hook attribute with a name

Sourceval 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
Sourceval many_without_merge : t list -> t

Like many, except instead of merging attributes of the same type, it takes the last one. Don't use this function - use many instead.

Sourceval empty : t

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

Sourceval (@) : t -> t -> t

Equivalent to combine

Sourceval combine : t -> t -> t

Equivalent to many [x; y]

Sourceval autofocus : bool -> t
Sourceval checked : t
Sourceval class_ : string -> t
Sourceval classes : string list -> t
Sourceval classes' : Core.Set.M(Core.String).t -> t
Sourceval disabled : t
Sourceval for_ : string -> t
Sourceval label : string -> t
Sourceval href : string -> t
Sourceval target : string -> t
Sourceval id : string -> t
Sourceval name : string -> t
Sourceval placeholder : string -> t
Sourceval selected : t
Sourceval hidden : t
Sourceval readonly : t
Sourceval style : Css_gen.t -> t
Sourceval min : float -> t
Sourceval max : float -> t
Sourceval min_date : Core.Date.t -> t
Sourceval max_date : Core.Date.t -> t
Sourceval min_date_time : Core.Date.t -> t

Sets the min time of a datetime-local picker to any time in the specified date. This function receives a Date.t instead of a Time_ns.t because the browser doesn't actually limit the time part of a datetime-local picker, even if a time is specified.

Sourceval max_date_time : Core.Date.t -> t

Similar to min_date_time, but sets the maximum instead.

Sourceval colspan : int -> t
Sourceval rowspan : int -> t
Sourceval draggable : bool -> t
Sourceval tabindex : int -> t
Sourceval type_ : string -> t
Sourceval value : string -> t
Sourceval value_prop : string -> t
Sourceval title : string -> t
Sourceval alt : string -> t
Sourceval src : string -> t
Sourceval open_ : t
Sourceval start : int -> t
Sourcemodule Unmerged_warning_mode : sig ... end
Sourceval 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

Sourceval 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.

Sourceval css_var : name:string -> string -> t

Sets a css named variable on the element. The "--" prefix is added by this function: css_var ~name:"foo" "red" is equivalent to the css --foo: red.

Sourceval __css_vars_no_kebabs : (string * string) list -> t

For ppx use only

Sourcemodule Multi : sig ... end

A collection of CSS attributes.

Sourcemodule Always_focus_hook : sig ... end
Sourcemodule Single_focus_hook () : sig ... end
Sourcemodule No_op_hook (M : sig ... end) : sig ... end
Sourcemodule Expert : sig ... end
Sourcemodule Hooks : sig ... end
Sourcemodule Global_listeners : sig ... end

Hooks to set 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.