Doggo (Doggo v0.15.0)

Copy Markdown View Source

This module only contains miscellaneous functions.

The components are defined in Doggo.Components.

Summary

JS

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

Returns all component classes and data attributes used in the given components module.

JS

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

(since 0.1.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={hide_modal("pet-modal")}>hide</.link>

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

(since 0.1.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={show_modal("pet-modal")}>show</.link>

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

(since 0.5.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.show_tab("my-tabs", 2)

Functions

safelist(module)

(since 0.13.0)
@spec safelist(module()) :: [String.t()]

Returns all component classes and data attributes used in the given components module.

This includes the base classes, nested classes (based on the base class) and modifier classes.

Usage

safelist(MyAppWeb.CoreComponents)
#=> ["button", "data-size", "data-variant"]