Skip to content

Remove Button

A specialized button component for deletion actions with built-in confirmation and loading states.

Usage

html
<remove-button 
  @remove="handleRemove"
  :loading="isRemoving"
></remove-button>

Props

PropTypeDefaultDescription
type'primary' | 'success' | 'warning' | 'danger''danger'Button type
size'small' | 'default' | 'large''default'Button size
loadingbooleanfalseLoading state
disabledbooleanfalseDisabled state
iconstring'delete'Icon to display
textstring'Remove'Button text
confirmMessagestringundefinedCustom confirmation message
showConfirmationbooleantrueWhether to show confirmation dialog

Events

EventPayloadDescription
removenoneEmitted when removal is confirmed
clicknoneEmitted on button click (before confirmation)

Features

  • Built-in Confirmation: Optional confirmation dialog before removal
  • Loading States: Integrated loading state for async operations
  • Customizable: Flexible text, icon, and styling options
  • Accessibility: Proper ARIA labels and keyboard navigation

Examples

Basic Remove Button

html
<script setup>
const isRemoving = ref(false)

async function handleRemove() {
  isRemoving.value = true
  try {
    await deleteItem(itemId)
    ElMessage.success('Item removed successfully')
  } finally {
    isRemoving.value = false
  }
}
</script>

<template>
  <remove-button 
    @remove="handleRemove"
    :loading="isRemoving"
  />
</template>

Custom Text and Icon

html
<remove-button 
  text="Delete User"
  icon="user-delete"
  size="small"
  @remove="deleteUser"
/>

Without Confirmation

html
<remove-button 
  :show-confirmation="false"
  text="Clear Cache"
  type="warning"
  @remove="clearCache"
/>

Custom Confirmation Message

html
<remove-button 
  confirm-message="This will permanently delete the user and all associated data. Continue?"
  @remove="deleteUserPermanently"
/>

In Table Actions

html
<el-table-column label="Actions" width="120">
  <template #default="{ row }">
    <remove-button 
      size="small"
      @remove="() => removeRow(row.id)"
    />
  </template>
</el-table-column>

© Velocitech LTD. All rights reserved.

Build SaaS Products Without Limits.