Handler Actions
Handler actions execute a function from the runtime registry.
Use handler actions when UI behavior is app-specific, when a docs demo needs static mocked behavior, or when an action needs more than a simple endpoint call.
Schema usage
TS
export const usersSchema = {
resource: "users",
actions: {
row: [
{
key: "reset-password",
label: "Reset password",
icon: "lucide:key-round",
handler: "users.resetPassword",
confirm: {
title: "Reset password?",
description: "The user will receive a reset email.",
confirmLabel: "Send email"
}
}
]
},
registry: {
actionHandlers: ["users.resetPassword"]
}
} as const;Runtime registry
TS
import { createRegistry } from "@vibeflui/core";
export const registry = createRegistry({
actionHandlers: {
"users.resetPassword": async ({ row }) => ({
status: true,
code: 200,
message: `Password reset email sent to ${String(row?.email ?? "the user")}`
})
}
});Handler priority
If an action has both handler and endpoint, the action resolves as a handler action. The resolved endpoint is still available in context.
TS
{
key: "approve",
handler: "users.approve",
endpoint: { url: "/api/users/:id/approve", method: "POST" }
}Schema handlers fallback
Handlers can also be declared by operation at the schema root.
TS
export const usersSchema = {
resource: "users",
handlers: {
create: "users.create",
update: "users.update",
delete: "users.delete"
},
registry: {
actionHandlers: ["users.create", "users.update", "users.delete"]
}
} as const;Prefer action-level handler in examples when clarity matters.