LiveView JS helpers for controlling interactive Cinder UI components.
These helpers dispatch the shared cinder-ui:command event used by
commandable hooks such as dialogs, popovers, dropdown menus, selects,
autocompletes, and comboboxes.
Example
<button phx-click={CinderUI.JS.open(to: "#account-dialog")}>
Open dialog
</button>
<button phx-click={CinderUI.JS.clear(to: "#owner-autocomplete")}>
Clear owner
</button>
Summary
Functions
Dispatches a clear command.
Dispatches a close command.
Dispatches a Cinder UI command event to the given selector.
Dispatches a focus command.
Dispatches an open command.
Dispatches a toggle command.
Types
Functions
@spec clear(keyword()) :: Phoenix.LiveView.JS.t()
Dispatches a clear command.
@spec clear( Phoenix.LiveView.JS.t(), keyword() ) :: Phoenix.LiveView.JS.t()
@spec close(keyword()) :: Phoenix.LiveView.JS.t()
Dispatches a close command.
@spec close( Phoenix.LiveView.JS.t(), keyword() ) :: Phoenix.LiveView.JS.t()
@spec dispatch_command( command(), keyword() ) :: Phoenix.LiveView.JS.t()
Dispatches a Cinder UI command event to the given selector.
Options
:to- required DOM selector that identifies the component root.:detail- additional event detail merged into the command payload.
@spec dispatch_command(Phoenix.LiveView.JS.t(), command(), keyword()) :: Phoenix.LiveView.JS.t()
@spec focus(keyword()) :: Phoenix.LiveView.JS.t()
Dispatches a focus command.
@spec focus( Phoenix.LiveView.JS.t(), keyword() ) :: Phoenix.LiveView.JS.t()
@spec open(keyword()) :: Phoenix.LiveView.JS.t()
Dispatches an open command.
@spec open( Phoenix.LiveView.JS.t(), keyword() ) :: Phoenix.LiveView.JS.t()
@spec toggle(keyword()) :: Phoenix.LiveView.JS.t()
Dispatches a toggle command.
@spec toggle( Phoenix.LiveView.JS.t(), keyword() ) :: Phoenix.LiveView.JS.t()