Skip to content

RowAction

RowAction = object

Defined in: packages/admin/src/types.ts:220

A custom action that appears on each row in a table’s list view.

Row actions are invoked with the record’s primary key, the submitted form data, and a RowActionContext containing the authenticated admin, a permission-scoped Db instance, the admin’s grants, and the raw Request.

const publishAction: RowAction = {
label: "Publish",
async action(id, _formData, ctx) {
await ctx.db
.update(posts)
.set({ published: true })
.where(eq(posts.id, id))
.run({});
},
confirm: "Are you sure you want to publish this post?",
variant: "default",
};

action: RowActionCallback

Defined in: packages/admin/src/types.ts:224

Async handler called with the record ID, submitted form data, and a RowActionContext.


optional confirm: string

Defined in: packages/admin/src/types.ts:226

Optional confirmation message. When set, the admin shows a confirm dialog before executing.


label: string

Defined in: packages/admin/src/types.ts:222

Display label for the action button.


optional variant: "danger" | "default"

Defined in: packages/admin/src/types.ts:228

Button styling variant. "danger" renders a destructive-style button. Defaults to "default".