VVibeFlui

Delete Actions

Delete actions are destructive and should use danger styling and confirmation.

VibeFlui default delete actions use:

  • key delete
  • label Delete
  • icon mdi:trash-can-outline
  • display icon
  • variant danger
  • confirm: true

Default delete action

TS
export const usersSchema = {
  resource: "users",
  actions: {
    delete: {
      enabled: true
    }
  }
} as const;
TS
export const usersSchema = {
  resource: "users",
  identity: {
    key: "id",
    param: "id"
  },
  actions: {
    delete: {
      enabled: true,
      label: "Delete",
      icon: "lucide:trash-2",
      variant: "danger",
      handler: "users.delete",
      confirm: {
        title: "Delete user?",
        description: "This action cannot be undone.",
        confirmLabel: "Delete",
        cancelLabel: "Cancel",
        icon: "lucide:triangle-alert"
      },
      refreshOnSuccess: true
    }
  },
  registry: {
    actionHandlers: ["users.delete"]
  }
} as const;

Delete handler

TS
import { createRegistry } from "@vibeflui/core";

export const registry = createRegistry({
  actionHandlers: {
    "users.delete": async ({ identityValue }) => ({
      status: true,
      code: 200,
      message: `User ${String(identityValue)} deleted`
    })
  }
});

Warning delete

Use status: false with a 400..499 code for backend responses that should render as warning feedback.

JSON
{
  "status": false,
  "code": 409,
  "message": "Workspace owner cannot be deleted"
}

Failed delete

JSON
{
  "status": false,
  "code": 403,
  "message": "You do not have permission to delete this user"
}

Two-step delete

TS
{
  key: "delete",
  label: "Delete",
  variant: "danger",
  handler: "users.delete",
  confirm: {
    title: "Delete user?",
    description: "This action cannot be undone.",
    confirmLabel: "Continue",
    secondConfirm: {
      title: "Confirm permanent delete",
      description: "The backend must still authorize this request.",
      confirmLabel: "Delete permanently"
    }
  }
}

Backend responsibility

Delete buttons are not authorization. The backend must check permission, resource ownership, workflow locks, audit requirements, and final delete rules.