<custom-button>

CustomSubmitButton

An AJAX-powered form button that auto-detects icons from label text, shows loading state, handles confirmation dialogs for destructive actions, and integrates with any form by ID.

AJAX Auto-Icons Confirmation Loading State
<script src="button.js"></script>

Basic Examples

<!-- Save button - auto-detects floppy disk icon -->
<custom-button
  label="Save Changes"
  form-id="myForm"
  post="/api/save"
  buttontype="success"
></custom-button>

<!-- Delete with confirmation modal -->
<custom-button
  label="Delete Record"
  form-id="myForm"
  post="/api/delete"
  buttontype="danger"
  method="DELETE"
></custom-button>

<!-- Create button -->
<custom-button
  label="Create New"
  form-id="myForm"
  post="/api/create"
  buttontype="info"
></custom-button>

Confirmation Dialog

Any button with "delete" in the label automatically triggers a Bootstrap confirmation modal before AJAX submission. Customize the message or skip it.

<!-- Auto-triggers confirmation for "delete" labels -->
<custom-button
  label="Delete Account"
  form-id="accountForm"
  post="/api/delete-account"
  confirm-title="Delete Account?"
  confirm-message="This will permanently delete your account."
></custom-button>

<!-- Skip confirmation -->
<custom-button
  label="Delete Draft"
  skip-confirmation="true"
  post="/api/delete-draft"
></custom-button>

Auto Icon Detection

Icons are automatically chosen from the button's label. Override with icon, or disable with disable-auto-icon="true".

Label contains "save"
💾 floppy-disk
Label contains "delete"
🗑 trash
Label contains "edit"
✏️ pencil-simple
Label contains "create"
➕ plus
Label contains "download"
⬇️ download-simple
Label contains "submit"
✈️ paper-plane-tilt
<!-- Custom icon override -->
<custom-button
  label="Launch Campaign"
  icon="rocket"
  icon-position="end"
  icon-size="16"
></custom-button>

<!-- Disable auto-icon -->
<custom-button
  label="Submit"
  disable-auto-icon="true"
></custom-button>

Attributes

AttributeTypeDescriptionDefault
labelstringButton text. Drives auto-icon detection.Submit
form-idstringID of the form to serialize on click
poststringAJAX submission URL
methodstringHTTP method: GET, POST, PUT, DELETE, PATCHPOST
buttontypestringBootstrap variant: danger, warning, success, infowarning
showspinnerbooleanShow loading spinner during AJAXfalse
confirm-titlestringModal title for delete confirmationConfirm Delete
confirm-messagestringModal body textAre you sure?
skip-confirmationbooleanSkip confirmation even for delete actionsfalse
iconstringPhosphor icon name overrideauto
icon-positionstringIcon position: start or endstart
icon-sizenumberIcon size in px14
disable-auto-iconbooleanTurn off automatic icon detectionfalse
targetstringCSS selector — replace innerHTML with AJAX response
<icon-button>

IconButton

A compact icon-only button with ripple effects, AJAX support, toast notifications, and Phosphor icon integration.

<script src="smart_button.js"></script>

Examples

<smart-button
  icon="pencil-simple"
  tooltip="Edit"
  color="primary"
  get="/api/edit/"
></smart-button>

<smart-button
  icon="trash"
  tooltip="Delete"
  color="danger"
  post="/api/delete/"
  toast="Item deleted"
></smart-button>

<smart-button
  icon="download-simple"
  tooltip="Export"
  href="/export/csv"
></smart-button>

Attributes

AttributeTypeDescriptionDefault
iconstringPhosphor icon name (e.g., trash, pencil-simple)
tooltipstringTooltip text shown on hover
colorstringColor theme: primary, danger, success, warningprimary
getstringAJAX GET request URL
poststringAJAX POST request URL
hrefstringNavigate to URL on click
toaststringToast message shown on success
sizestringButton size: sm, md, lgmd