diff --git a/resources/js/composables/useActiveUrl.ts b/resources/js/composables/useActiveUrl.ts
index 26cb3a40..d4c93cca 100644
--- a/resources/js/composables/useActiveUrl.ts
+++ b/resources/js/composables/useActiveUrl.ts
@@ -20,7 +20,7 @@ const toPathname = (url: string): string => {
export function useActiveUrl() {
function urlIsActive(
urlToCheck: NonNullable,
- options?: { prefix?: boolean; exact?: boolean },
+ options?: { prefix?: boolean; exact?: boolean; exclude?: string[] },
) {
const current = currentUrlReactive.value;
const pathname = toPathname(toUrl(urlToCheck));
@@ -33,10 +33,14 @@ export function useActiveUrl() {
return current.startsWith(pathname);
}
- return (
- current === pathname ||
- (pathname !== '/' && current.startsWith(pathname + '/'))
- );
+ const isMatch = current === pathname ||
+ (pathname !== '/' && current.startsWith(pathname + '/'));
+
+ if (isMatch && options?.exclude) {
+ return !options.exclude.some((ex) => current === toPathname(ex) || current.startsWith(toPathname(ex) + '/'));
+ }
+
+ return isMatch;
}
return {
diff --git a/resources/js/types/index.d.ts b/resources/js/types/index.d.ts
index 2fd98bbe..1626c969 100644
--- a/resources/js/types/index.d.ts
+++ b/resources/js/types/index.d.ts
@@ -18,6 +18,7 @@ export interface NavItem {
isActive?: boolean;
activePattern?: string;
exact?: boolean;
+ excludeActive?: string[];
}
export interface SharedData {