package virtual_dom

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val simple : ?extra_attrs:Virtual_dom.Vdom.Attr.t list -> ?disabled:bool -> ?merge_behavior:Merge_behavior.t -> string -> on_click:(unit -> unit Virtual_dom.Vdom.Effect.t) -> Virtual_dom.Vdom.Node.t

Though simple is fairly trivial, it is provided as a convenient parallel to with_validation

val with_validation : ?extra_attrs:Virtual_dom.Vdom.Attr.t list -> ?merge_behavior:Merge_behavior.t -> string -> validation:('a, string) Core.Result.t -> on_click:('a -> unit Virtual_dom.Vdom.Effect.t) -> Virtual_dom.Vdom.Node.t

Takes a ('a, string) Result.t that is typically the result of some validation performed incrementally. If the validation failed, the button will be disabled and will show a tooltip on hover with the error reason. If the validation is ok, the 'a is passed to the on_click handler. You can compose multiple validity checks with the Result applicative interface.

OCaml

Innovation. Community. Security.