Action · Pattern
type, phx-click, and Corex JS commands on <.action>.
Type
<.form for={%{}} as={:demo} phx-submit="noop">
<.action class="button" type="button">Button</.action>
<.action class="button button--accent" type="submit">Submit</.action>
<.action class="button button--ghost" type="reset">Reset</.action>
</.form>
Trigger · phx-click
<.action
phx-click={
Corex.Toast.create("layout-toast", "Clicked", "phx-click with Corex.Toast.create/5", :info,
duration: 5000
)
}
class="button button--sm"
>
Show toast
</.action>
Trigger · phx-click JS
Dialog
Opened from an action with phx-click and a Corex JS command.
<.action
phx-click={Corex.Dialog.set_open("action-patterns-dialog", true)}
class="button button--sm"
>
Open dialog
</.action>
<.dialog id="action-patterns-dialog" class="dialog">
<:trigger class="hidden">Open</:trigger>
<:title>Dialog</:title>
<:content>
<p>Opened from an action with phx-click and a Corex JS command.</p>
</:content>
<:close_trigger>
<.heroicon name="hero-x-mark" />
</:close_trigger>
</.dialog>