Module Ui.Jstr_editor

String editors.

String editors are for editing short strings. See the styling information.

String editors

type t

The type for string editors.

val v : ?⁠class':Jstr.t -> ?⁠enabled:bool Note.signal -> ?⁠on:'a Note.event -> ?⁠length:int Note.signal -> Jstr.t Note.signal -> t

v ~class' ~enabled ~on ~size s is an editor for a string:

  • s is the string value to edit.
  • length is the length of the editor in number of characters (defaults to S.const 20).
  • on can be used to put the string editor on focus and in editing mode.
  • enabled indicates if the editor can be interacted with defaults to S.Bool.true'.
  • class' is added to the underlying element's classes.
val action : t -> Jstr.t Note.event

action e occurs with a new string when an edition was validated.

val enabled : t -> bool Note.signal

enabled e is true iff the editor is enabled.

val editing : t -> bool Note.signal

editing e is true whenever the string is being edited.

val el : t -> Brr.El.t

el b is b's DOM element.


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

  • ui-str-editor always.
  • ui-editing whenever editing is true.
  • ui-disabled whenever enabled is false.