diff --git a/packages/core/src/hooks/useClickOutside/__stories__/useClickOutside.mdx b/packages/core/src/hooks/useClickOutside/__stories__/useClickOutside.mdx
index b41076e763..550a549fe9 100644
--- a/packages/core/src/hooks/useClickOutside/__stories__/useClickOutside.mdx
+++ b/packages/core/src/hooks/useClickOutside/__stories__/useClickOutside.mdx
@@ -39,6 +39,11 @@ This hook is used when you want to capture click events outside your component.
description="Callback function to execute on outside clicks."
required
/>
+
;
callback: GenericEventCallback;
+ ignoreClasses?: string[];
eventName?: keyof HTMLElementEventMap | string;
}) {
const onClickOutsideListener = useCallback(
@@ -17,6 +19,11 @@ export default function useClickOutside({
return;
}
+ const shouldIgnoreClasses = ignoreClasses && event.target instanceof HTMLElement;
+ if (shouldIgnoreClasses && event.target.closest(ignoreClasses.join(","))) {
+ return;
+ }
+
callback(event);
},