X Enterprises
Bulk Action

BulkActionAssign

Assign selected rows to an option from a dropdown.

Bulk Action

Bulk action components sit in a table toolbar and operate on an array of selected rows. Each component is disabled when no rows are selected and emits success/error events so the parent can refresh data and clear the selection.

Components

<XABulkActionAssign />

Renders a neutral dropdown button listing options. Selecting an option sends a PATCH to endpoint with { [assignField]: value } for each selected item ID.

<XABulkActionAssign
  :selected="selectedRows"
  endpoint="api/tasks"
  :options="[
    { value: 1, label: 'Alice', avatar: '/avatars/alice.png' },
    { value: 2, label: 'Bob' },
  ]"
  item-name="tasks"
  target-name="assignee"
  allow-unassign
  :on-success="() => refresh()"
/>

Props

PropTypeDefaultDescription
selectedunknown[]Required. Array of selected row data objects.
endpointstringRequired. API endpoint path (no leading slash).
optionsAssignOption[]Required. Items to list: { value, label, icon?, avatar? }.
idKeystring'id'Key used to extract the ID from each item.
assignFieldstring'assigneeId'Payload field name for the assignment value.
labelstring'Assign'Button label text.
iconstring'i-lucide-user-plus'Button icon name.
showLabelbooleantrueShow label text on the button.
itemNamestring'items'Noun used in toast messages.
targetNamestring'assignee'Assignment target noun used in toast messages.
disabledbooleanfalseForce-disable the button.
allowUnassignbooleanfalsePrepend an "Unassign" option to the dropdown.
onSuccess() => void | Promise<void>Callback invoked after a successful assignment.
clearSelection() => voidCallback to clear the parent selection state.

Emits

EventPayloadDescription
success(ids: (string | number)[], assigneeId: string | number | null)Fired after all assignments succeed.
error(error: unknown)Fired if any PATCH request fails.

AI Context

component: XABulkActionAssign
package: "@xenterprises/nuxt-x-app"
category: BulkAction
use-when: >
  User has selected one or more rows in a data table and needs to assign
  them to a user or category. Place in the table toolbar alongside the
  selection checkbox.
patterns:
  - Accepts a selected array and disables itself when it is empty
  - Uses inline dropdown — no confirmation modal
  - Pass onSuccess and clearSelection callbacks to refresh data after assignment
  - API calls use config.public.x.app.apiUrl as the base URL
Copyright © 2026