Module Skyline_dialog_v1Source

Dialog elements, also sometimes called modal elements, are a UI element that presents some screen above the page contents, making the page contents inaccessible to the user while the dialog is active.

They are most commonly used for alerts or confirm interactions, but can also be used to provide custom content like a command pallet, or form to complete some complex action.

Sourcemodule Position : sig ... end
Sourcemodule Restore_focus_on_close : sig ... end
Sourceval component : ?test_selector:Bonsai_web.Test_selector.t -> ?close_on_click_outside:bool Bonsai_web.Bonsai.t -> ?close_on_esc:bool Bonsai_web.Bonsai.t -> ?position:Position.t Bonsai_web.Bonsai.t -> ?padding:Css_gen.Length.t Bonsai_web.Bonsai.t -> ?restore_focus_on_close:Restore_focus_on_close.t Bonsai_web.Bonsai.t -> (Bonsai_web.Bonsai.graph @ local -> Bonsai_web.Vdom.Node.t Bonsai_web.Bonsai.t) -> close:unit Bonsai_web.Effect.t Bonsai_web.Bonsai.t -> Bonsai_web.Bonsai.graph @ local -> unit

Render a modal unconditionally (allowing callers to decide when the modal is open).

close is an effect that should stop displaying this modal.

Note that the modal might also be dismissed by the users in some way, e.g. by pressing Esc.

position can be used to determine where the modal is placed on screen while visible and defaults to Center.

close_on_click_outside determines if the modal closes when the user clicks outside of it and is false by default.

close_on_esc determines if the modal closes when the user hits the esc key and is true by default as defined in Toplayer

Sourceval effect : ?state: (bool Bonsai_web.Bonsai.t * (bool -> unit Bonsai_web.Effect.t) Bonsai_web.Bonsai.t) -> ?position:Position.t Bonsai_web.Bonsai.t -> ?padding:Css_gen.Length.t Bonsai_web.Bonsai.t -> ?close_on_click_outside:bool Bonsai_web.Bonsai.t -> ?close_on_esc:bool Bonsai_web.Bonsai.t -> ?restore_focus_on_close:Restore_focus_on_close.t Bonsai_web.Bonsai.t -> (close:unit Bonsai_web.Effect.t Bonsai_web.Bonsai.t -> Bonsai_web.Bonsai.graph @ local -> Bonsai_web.Vdom.Node.t Bonsai_web.Bonsai.t) -> Bonsai_web.Bonsai.graph @ local -> unit Bonsai_web.Effect.t Bonsai_web.Bonsai.t

Render a modal view that can be opened by running the returned effect, and closed by running the close effect supplied to the modal contents.

Sourceval alert : Bonsai_web.Bonsai.graph @ local -> (?intent:Skyline_theme_v1.Color.t -> ?button_label:string -> title:string -> string -> unit Bonsai_web.Effect.t) Bonsai_web.Bonsai.t

Render an alert dialog with the given title and message.

Sourceval confirm : Bonsai_web.Bonsai.graph @ local -> (?intent:Skyline_theme_v1.Color.t -> ?cancel_label:string -> ?confirm_label:string -> title:string -> string -> bool Bonsai_web.Effect.t) Bonsai_web.Bonsai.t

Render a confirm dialog. If the user dismissed the dialog this returns false, otherwise this returns true.