package bonsai

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

Module type Variant.SSource

This module should be generated by deriving typed_variants on a sum type.

val label_for_variant : [ `Inferred | `Computed of 'a Typed_variant.t -> string | `Dynamic of (Typed_variant.Packed.t -> string) Bonsai_web.Value.t ]

The label to use for each variant in your sum type in the dropdown. If this value is `Inferred, the name of the variant constructor will be used. If this value is `Computed f, then the dropdown labels will be the result of calling f on each of the variants.

val form_for_variant : 'a Typed_variant.t -> 'a Bonsai_web_ui_form__.Form.t Bonsai_web.Computation.t

For each of the variants in your sum type, you need to provide a form component which produces values of that type.

val initial_choice : [ `First_constructor | `Empty | `This of Typed_variant.Packed.t ]