package bonsai
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c78c4476ee6b856846e2d0941e5965009d5e1b853e564b2b1bee61202f0b1ebb
doc/bonsai.web_ui_auto_generated/Bonsai_web_ui_auto_generated/index.html
Module Bonsai_web_ui_auto_generatedSource
type form_transformer =
Sexp_grammar.grammar Sexp_grammar.with_tag Bonsai_web.Value.t ->
recurse:
(Sexp_grammar.grammar Bonsai_web.Value.t ->
Core.Sexp.t Form.t Bonsai_web.Computation.t) ->
Core.Sexp.t Form.t Bonsai_web.Computation.tCustomizations allow you to use custom logic for leaves of your view/form generation. When a tagged sexp_grammar is encountered, apply_to_tag will be invoked on the tag's key and value. If apply_to_tag returns true, then the custom logic will be used in place of the default auto-generated logic.
val form :
(module S with type t = 'a) ->
?on_set_error:(Core.Sexp.t -> unit Bonsai_web.Effect.t) ->
?customizations:form_transformer Customization.t list ->
?textbox_for_string:unit ->
?allow_duplication_of_list_items:bool ->
unit ->
'a Form.t Bonsai_web.Computation.tform takes a type 'a and its sexp grammar and produces a 'a Form.t.
on_set_error defaults to Effect.print_s and allows customization of what happens if Form.set produces an error while operating on the sexp representation of the type. For types which derive sexp and sexp_grammar, on_set_error should not be called, but it may for types with hand-rolled grammars or sexp functions.
customizations is a list of customizations to use while generating the form (see above). Customizations are tried in the provided order, using the result of the first matching customization.
Grammar fields tagged with key Ppx_sexp_conv_lib.Sexp_grammar.doc_comment_tag will be converted into tooltips. This tag is added automatically to doc comments on types which derive sexp_grammar with the ~tags_of_doc_comments option.
If textbox_for_string is supplied, string inputs will be textboxes rather than textareas (meaning the form can be submitted with Enter when those fields are active, but users will not be able to input multiline strings).
allow_duplication_of_list_items defaults to true and controls whether a "duplicate" button is shown next to all list as a shortcut to duplicate that item in the list.
val form' :
?on_set_error:(Core.Sexp.t -> unit Bonsai_web.Effect.t) ->
?customizations:form_transformer Customization.t list ->
?textbox_for_string:unit ->
?allow_duplication_of_list_items:bool ->
Sexp_grammar.grammar Bonsai_web.Value.t ->
Core.Sexp.t Form.t Bonsai_web.Computation.tform' is similar to form, but takes an untyped sexp grammar as a value, and produces a Sexp.t Form.t. This allows you to create a form that depends on a dynamic sexp grammar.
val view_as_vdom :
?on_submit:'a Bonsai_web_ui_form.With_automatic_view.Submit.t ->
?editable:[ `Yes_always | `Currently_yes | `Currently_no ] ->
'a Form.t ->
Bonsai_web.Vdom.Node.tview_as_vdom provides a custom rendering function for the form generated by form, which is optimized to look good, even with many levels of nesting.