package brr

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

Buttons.

See the styling information.

Buttons

type 'a t

The type for buttons whose action occurs with type 'a.

val v : ?class':Jstr.t -> ?active:bool Note.signal -> ?enabled:bool Note.signal -> ?tip:Jstr.t Note.signal -> Brr.El.t list Note.signal -> 'a -> 'a t

v ~class' ~active ~enabled ~tip label action is a button with:

  • label the button's label.
  • action the value reported when the button is actuated.
  • tip a tooltip for the button.
  • enabled indicates if the button can be interacted with. Defaults to S.Bool.true'.
  • active indicates that the button is being interacted with programmatically (e.g. via a shortcut)
  • class' is added to the underlying element's classes
val action : 'a t -> 'a Note.event

action b is an event that occurs when the button is actuated.

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

enabled b is a signal that is true iff the button is enabled.

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

active b is a signal that is true iff the button is being interacted with. FIXME. For now this doesn't change on mouse activation.

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

el b is b's DOM element.

Special buttons

val file_selector : ?class':Jstr.t -> ?active:bool Note.signal -> ?enabled:bool Note.signal -> ?tip:Jstr.t Note.signal -> ?exts:string list -> Brr.El.t list Note.signal -> Brr.File.t t

file_selector ~exts cs is a button which, whenever clicked, allows to select a file on the host's file system. exts is the caseless list of file extensions (including the dot) that can be selected; all file can be selected if this is the empty list (default).

The resulting element as an additional ui-file-selector class. See Styling.

val files_selector : ?class':Jstr.t -> ?active:bool Note.signal -> ?enabled:bool Note.signal -> ?tip:Jstr.t Note.signal -> ?exts:string list -> Brr.El.t list Note.signal -> Brr.File.t list t

files_selector is like file_selector but allows multiple files to be selected.

Styling

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

OCaml

Innovation. Community. Security.