Doggo.JS (Doggo v0.18.4)

Copy Markdown View Source

Commands for the JavaScript hooks of the components, to use in phx-click and other bindings.

Summary

Functions

Hides the modal with the given ID.

Shows the modal with the given ID.

Shows the tab with the given index of the tabs/1 component with the given ID.

Functions

hide_modal(js \\ %JS{}, id)

(since 0.18.0)

Hides the modal with the given ID.

The component needs its JavaScript hook registered, since this function uses the hook to call close() on the dialog.

Example

<.link phx-click={Doggo.JS.hide_modal("pet-modal")}>hide</.link>

show_modal(js \\ %JS{}, id)

(since 0.18.0)

Shows the modal with the given ID.

The component needs its JavaScript hook registered, since this function uses the hook to call showModal() on the dialog.

Example

<.link phx-click={Doggo.JS.show_modal("pet-modal")}>show</.link>

show_tab(js \\ %JS{}, id, index)

(since 0.18.0)

Shows the tab with the given index of the tabs/1 component with the given ID.

The index is one-based. The component needs its JavaScript hook registered, since this function uses the hook to select the tab.

Example

Doggo.JS.show_tab("my-tabs", 2)