PhoenixKitWeb.Components.Core.FormActions (phoenix_kit v1.7.117)

Copy Markdown View Source

Form-footer action bar — Cancel link + Submit button, right-aligned.

Replaces the repeated boilerplate:

<div class="flex justify-end gap-3">
  <.link navigate={cancel_path} class="btn btn-ghost">Cancel</.link>
  <button type="submit" class="btn btn-primary" phx-disable-with="Saving…">
    {submit_label}
  </button>
</div>

with a single component call.

Attributes

  • cancel_to — Path the Cancel link navigates to. Required.
  • submit_label — Text on the submit button (e.g. "Save", "Create Endpoint"). Required.
  • submitting_labelphx-disable-with text shown while the form is submitting. Defaults to "Saving…" (gettext-translated).
  • submit_icon — Optional Heroicon name rendered inside the submit button (e.g. "hero-check").
  • submit_class — Class for the submit button. Default "btn btn-primary".
  • class — Extra classes appended to the outer wrapper.

Slots

  • inner_block — Optional extra controls rendered BEFORE Cancel + Submit (e.g. a secondary "Save and Return" button).

Example

<.form_actions
  cancel_to={Paths.endpoints()}
  submit_label={if @endpoint, do: gettext("Update"), else: gettext("Create")}
  submit_icon="hero-check"
/>

Summary

Functions

form_actions(assigns)

Attributes

  • cancel_to (:string) (required)
  • submit_label (:string) (required)
  • submitting_label (:string) - Defaults to nil.
  • submit_icon (:string) - Defaults to nil.
  • submit_class (:string) - Defaults to "btn btn-primary".
  • class (:string) - Defaults to nil.

Slots

  • inner_block