diff --git a/docs/src/docs/others/spotlight.mdx b/docs/src/docs/others/spotlight.mdx
index a1bba503b84..7a3507147b7 100644
--- a/docs/src/docs/others/spotlight.mdx
+++ b/docs/src/docs/others/spotlight.mdx
@@ -296,6 +296,13 @@ To change this behavior set `closeOnActionTrigger={false}` prop on `SpotlightPro
+## Close spotlight on specific action trigger
+
+Other than with the global `closeOnActionTrigger` property, the `closeOnTrigger` property can be defined
+for specific actions. The action will then ignore the closeOnActionTrigger property and use its own definition.
+
+
+
## Highlight query
Default action component supports highlighting search query with [Highlight](/core/highlight/) component.
diff --git a/src/mantine-demos/src/demos/spotlight/Spotlight.demo.actionsCloseOnTrigger.tsx b/src/mantine-demos/src/demos/spotlight/Spotlight.demo.actionsCloseOnTrigger.tsx
new file mode 100644
index 00000000000..495c5216f0d
--- /dev/null
+++ b/src/mantine-demos/src/demos/spotlight/Spotlight.demo.actionsCloseOnTrigger.tsx
@@ -0,0 +1,43 @@
+import { SpotlightAction } from '@mantine/spotlight';
+import React from 'react';
+import { Wrapper } from './_wrapper';
+
+const code = `
+import { SpotlightProvider, SpotlightAction } from '@mantine/spotlight';
+
+const onTrigger = () => {};
+
+const actions: SpotlightAction[] = [
+ { title: 'Will stay open', onTrigger, closeOnTrigger: false },
+ { title: 'Will close', onTrigger, closeOnTrigger: true },
+];
+
+function Demo() {
+ return (
+
+
+
+ );
+}
+`;
+
+const onTrigger = () => {};
+
+const actions: SpotlightAction[] = [
+ { title: 'Will stay open', onTrigger, closeOnTrigger: false },
+ { title: 'Will close', onTrigger, closeOnTrigger: true },
+];
+
+function Demo() {
+ return ;
+}
+
+export const actionsCloseOnTrigger: MantineDemo = {
+ type: 'demo',
+ component: Demo,
+ code,
+};
diff --git a/src/mantine-demos/src/demos/spotlight/index.ts b/src/mantine-demos/src/demos/spotlight/index.ts
index f7eaf7b3abf..8894f76371c 100644
--- a/src/mantine-demos/src/demos/spotlight/index.ts
+++ b/src/mantine-demos/src/demos/spotlight/index.ts
@@ -3,6 +3,7 @@ export { transitionNone } from './Spotlight.demo.transitionNone';
export { customTransition } from './Spotlight.demo.customTransition';
export { large } from './Spotlight.demo.large';
export { closeOnTrigger } from './Spotlight.demo.closeOnTrigger';
+export { actionsCloseOnTrigger } from './Spotlight.demo.actionsCloseOnTrigger';
export { register } from './Spotlight.demo.register';
export { groups } from './Spotlight.demo.groups';
export { actionComponent } from './Spotlight.demo.actionComponent';
diff --git a/src/mantine-spotlight/src/Spotlight.story.tsx b/src/mantine-spotlight/src/Spotlight.story.tsx
index e7832c18418..dbf8e356a2b 100644
--- a/src/mantine-spotlight/src/Spotlight.story.tsx
+++ b/src/mantine-spotlight/src/Spotlight.story.tsx
@@ -214,4 +214,21 @@ storiesOf('Spotlight', module)
+ ))
+ .add('Actions with closeOnTrigger', () => (
+ console.log('Should stay open'),
+ closeOnTrigger: false,
+ },
+ {
+ title: 'Should close',
+ onTrigger: () => console.log('Should close'),
+ closeOnTrigger: true,
+ },
+ ]}
+ />
));
diff --git a/src/mantine-spotlight/src/Spotlight/Spotlight.tsx b/src/mantine-spotlight/src/Spotlight/Spotlight.tsx
index 67249b397df..e132a969854 100644
--- a/src/mantine-spotlight/src/Spotlight/Spotlight.tsx
+++ b/src/mantine-spotlight/src/Spotlight/Spotlight.tsx
@@ -266,7 +266,7 @@ export function Spotlight({
onActionHover={setHovered}
onActionTrigger={(action) => {
action.onTrigger(action);
- closeOnActionTrigger && handleClose();
+ (action.closeOnTrigger ?? closeOnActionTrigger) && handleClose();
}}
styles={styles}
classNames={classNames}
diff --git a/src/mantine-spotlight/src/types.ts b/src/mantine-spotlight/src/types.ts
index 3dcc2339354..7c2cd70ac59 100644
--- a/src/mantine-spotlight/src/types.ts
+++ b/src/mantine-spotlight/src/types.ts
@@ -22,6 +22,9 @@ export interface SpotlightAction {
/** Function that is called when action is triggered */
onTrigger(action: SpotlightAction): void;
+ /** If the spotlight is closed after clicking on this action */
+ closeOnTrigger?: boolean;
+
/** Any other properties that will be consumed by SpotlightProvider */
[key: string]: any;
}