Liking cljdoc? Tell your friends :D

reacl-c-basics.dialogs

Utilities for easy usage of User-Agent controlled <dialog> items.

See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog and https://caniuse.com/?search=dialog

Note: a major difference between this and the raw dialog is that the dialogs here are shown/open by default.

Utilities for easy usage of User-Agent controlled <dialog> items.

See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
and https://caniuse.com/?search=dialog

Note: a major difference between this and the raw dialog is that the
dialogs here are shown/open by default.
raw docstring

ackcljs

(ack)

Returns an action that can be emitted from the content of an acknowledge dialog.

Returns an action that can be emitted from the content of
an [[acknowledge]] dialog.
sourceraw docstring

acknowledgecljs

(acknowledge & content)
(acknowledge attrs & content)

Shows the content in an open modal dialog.

The :onAck event is triggered when the user presses ESC, or the content emits the ack action.

Shows the content in an open modal dialog.

The :onAck event is triggered when the user presses ESC, or the
content emits the [[ack]] action.
sourceraw docstring

cancelcljs

(cancel)

Returns an action that can be emitted from the content of an acknowledge dialog.

Returns an action that can be emitted from the content of
an [[acknowledge]] dialog.
sourceraw docstring

dialogcljs

The raw <dialog> dom item.

The raw <dialog> dom item.
sourceraw docstring

mediatorcljs

(mediator ask-f item-f)

A mediator simplifies showing modal dialogs in response to actions.

That can be used to let the user confirm certain actions, with a "Are you sure?" dialog, or even open an edit dialog in response to a button click. It could also be used to let the user acknowedge errors of Ajax calls.

For example, if you have a button that deletes an entity:

(dom/button {:onClick (constantly (c/return :action (delete entity-id)))})

To get an acknowledgement from the user before doing that, you can rewrite that button with:

(mediator (fn [hide entity-id]
            (prompt {:onOk (constantly (c/return :action hide
                                                 :action (delete entity-id)))
                     :onCancel (constantly (c/return :action hide))}
                    "Are you sure?"
                    (dom/button {:onClick (constantly (c/return :action (ok)))} "Ok")))
          (fn [show]
            (dom/button {:onClick (constantly (c/return :action (show entity-id)))})))

Note: Emitting a second (show ...) before the previous dialog has emitted hide will replace the previous dialog.

A mediator simplifies showing modal dialogs in response to actions.

That can be used to let the user confirm certain actions, with a
"Are you sure?" dialog, or even open an edit dialog in response
to a button click. It could also be used to let the user acknowedge
errors of Ajax calls.

For example, if you have a button that deletes an entity:

```
(dom/button {:onClick (constantly (c/return :action (delete entity-id)))})
```

To get an acknowledgement from the user before doing that, you can
rewrite that button with:

```
(mediator (fn [hide entity-id]
            (prompt {:onOk (constantly (c/return :action hide
                                                 :action (delete entity-id)))
                     :onCancel (constantly (c/return :action hide))}
                    "Are you sure?"
                    (dom/button {:onClick (constantly (c/return :action (ok)))} "Ok")))
          (fn [show]
            (dom/button {:onClick (constantly (c/return :action (show entity-id)))})))
```

Note: Emitting a second `(show ...)` before the previous dialog has
emitted `hide` will replace the previous dialog.
sourceraw docstring

(modal & content)
(modal attrs & content)

Shows the content in an open modal dialog.

The :onCancel event is trigger when the user presses ESC, which does nothing per default.

Render a hidden dialog via the :open attribute set to false, which can also be used to show/hide the dialog later.

Shows the content in an open modal dialog.

The :onCancel event is trigger when the user presses ESC, which
does nothing per default.

Render a hidden dialog via the :open attribute set to false, which
can also be used to show/hide the dialog later.
sourceraw docstring

okcljs

(ok)
(ok value)

Returns an action that can be emitted from the content of an acknowledge dialog.

Returns an action that can be emitted from the content of
an [[acknowledge]] dialog.
sourceraw docstring

parallelcljs

(parallel & content)
(parallel attrs & content)

Shows the content in an open non-modal dialog.

Render a hidden dialog via the :open attribute set to false, which can also be used to show/hide the dialog later.

Shows the content in an open non-modal dialog.

Render a hidden dialog via the :open attribute set to false, which
can also be used to show/hide the dialog later.
sourceraw docstring

promptcljs

(prompt & content)
(prompt attrs & content)

Shows the content in an open modal dialog.

The :onCancel event is triggered when the user presses ESC, or the content emits the cancel action.

The :onOk event is triggered when the content emits the ok action.

Shows the content in an open modal dialog.

The :onCancel event is triggered when the user presses ESC, or the
content emits the [[cancel]] action.

The :onOk event is triggered when the content emits the [[ok]] action.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close