Skip to main content

useBulkDeleteMeta

Resolves the confirmation dialog title, description, success message, and mutation mode for bulk delete operations. It applies ICU plural formatting based on the number of selected records. Use this inside a component rendered within a <List> context.

import { useBulkDeleteMeta } from '@strato-admin/core';

const MyBulkDeleteButton = ({ dialogTitle, dialogDescription }) => {
const { title, description } = useBulkDeleteMeta({
title: dialogTitle,
description: dialogDescription,
});
// title and description are already translated strings
};

Signature

function useBulkDeleteMeta(props?: UseBulkDeleteMetaProps): {
title: string;
description: string;
successMessage: string | ReactNode | ((count: number) => ReactNode) | undefined;
mutationMode: 'pessimistic' | 'optimistic' | 'undoable' | undefined;
};

interface UseBulkDeleteMetaProps {
title?: string;
description?: string;
successMessage?: string | ReactNode;
mutationMode?: 'pessimistic' | 'optimistic' | 'undoable';
}

Resolution order

For title and description, the hook resolves the first defined value:

  1. The prop passed directly to the hook
  2. The schema value from <ResourceSchema> (bulkDeleteTitle / bulkDeleteDescription)
  3. The built-in default translation key (strato.message.bulk_delete_title / strato.message.bulk_delete_content)

All values are treated as ICU translation keys and formatted with smart_count equal to the number of currently selected records. This enables correct singular/plural output — for example, "Delete this item" vs "Delete these 3 items".

For successMessage and mutationMode, the hook falls back to the <Settings> values.

Prop types are strings

Unlike the page-level meta hooks, title and description props are plain string (translation keys), not ReactNode. The hook always returns fully resolved string values.

Parameters

NameTypeDescription
props.titlestringTranslation key override for the dialog title.
props.descriptionstringTranslation key override for the dialog body.
props.successMessagestring | ReactNodeNotification shown after successful deletion.
props.mutationMode'pessimistic' | 'optimistic' | 'undoable'How the delete mutation behaves.

Return value

FieldTypeDescription
titlestringResolved and pluralized dialog title.
descriptionstringResolved and pluralized dialog body.
successMessagestring | ReactNode | ((count: number) => ReactNode) | undefinedPost-delete notification.
mutationMode'pessimistic' | 'optimistic' | 'undoable' | undefinedMutation behavior.

Context requirements

Must be called inside a <List> (or <ListBase>) tree so that useListContext can provide the selected IDs.

See also