Module Value_selector.Menu

Menu selector

The value is selected in a list of elements via a drop down menu. See the styling information.

Selectors

type 'a t

The type for menu selector of values of type 'a.

val v : ?⁠class':Jstr.t -> ?⁠enabled:bool Note.signal -> ('a -> Jstr.t) -> 'a list Note.signal -> 'a Note.signal -> 'a t

v ~class' ~enabled label choices sel is a menu for selecting a value. S.eq sel is used to test values for equality in the list of choices.

  • label is used to label the values to select
  • choices are the values among which to select
  • sel is the value shown as selected it must be included in choices
  • enabled indicates if the selector can be interacted with. Defaults to S.Bool.true'
  • class' is added to the underlying element's classes.
val action : 'a t -> 'a Note.event

action s occurs whenever a new value is selected.

val enabled : 'a t -> bool Note.signal

enabled s is true iff the selector is enabled.

val el : 'a t -> Brr.El.t

el s is s's DOM element.

Styling

The element returned by el makes use of the following CSS classes:

  • ui-menu-selector always.
  • ui-disabled whenever enabled is false.