bonsai
-
bonsai
-
-
bonsai.bench
-
bonsai.example_chat_open_source_native
-
bonsai.example_chat_open_source_native_common
-
-
bonsai.extra
-
-
bonsai.focus_ring
-
bonsai.protocol
-
bonsai.tailwind_colors
-
bonsai.test
-
bonsai.test.dot
-
bonsai.web_test
-
bonsai.web_ui_common_components
-
bonsai.web_ui_drag_and_drop
-
bonsai.web_ui_element_size_hooks
-
bonsai.web_ui_file
-
bonsai.web_ui_file_from_web_file
-
bonsai.web_ui_form
-
-
bonsai.web_ui_freeform_multiselect
-
bonsai.web_ui_multi_select
-
-
bonsai.web_ui_query_box
-
bonsai.web_ui_reorderable_list
-
bonsai.web_ui_typeahead
Library
Module
Module type
Parameter
Class
Class type
val with_default :
'a Bonsai_web.Value.t ->
'a t Bonsai_web.Value.t ->
'a t Bonsai_web.Computation.t
val error_hint : 'a t Bonsai_web.Value.t -> 'a t Bonsai_web.Computation.t
Adds a clickable error hint for this form
val collapsible_group :
?starts_open:bool ->
string Bonsai_web.Value.t ->
'a t Bonsai_web.Value.t ->
'a t Bonsai_web.Computation.t
Adds a group that is clickable. Visibility for sub-forms is initially determined by starts_open
but is toggled by clicking on the label.
val on_change :
?on_error:( Core.Error.t -> unit Ui_effect.t ) Bonsai_web.Value.t ->
(module Bonsai_web.Bonsai.Model with type t = 'a) ->
f:( 'a -> unit Ui_effect.t ) Bonsai_web.Value.t ->
'a t Bonsai_web.Value.t ->
unit Bonsai_web.Computation.t
Adds a on_change handler to a Form.t
.
The function f
is called when 1. the (successfully validated) value of the form changes. 2. the form transitions from producing an Error to producing a value. 3. the form initializes with a value
on_error
is called when 1. the error message changes 2. the form transitions from producing a value to an error 3. the form initializes with an error
val validate_via_effect :
(module Bonsai_web.Bonsai.Model with type t = 'a) ->
'a t Bonsai_web.Value.t ->
f:( 'a -> unit Core.Or_error.t Bonsai_web.Effect.t ) Bonsai_web.Value.t ->
'a t Bonsai_web.Computation.t
Unlike validate
which requires the validation function to be available locally (and synchronous), validate_via_effect
runs an effectful computation. The asynchrony makes this function interesting: When a value is in the midst of validated, the resultant form is resolved to an Error.
module Record_builder : sig ... end