-
I have the following code: 'use client';
import { usePathname } from 'next/navigation';
import { RootProvider } from 'fumadocs-ui/provider';
import { PropsWithChildren } from 'react';
export function SearchProvider({ children }: PropsWithChildren) {
const pathname = usePathname() ?? '';
const api = pathname.startsWith('/docs')
? '/api/search/docs'
: pathname.startsWith('/blog')
? '/api/search/blog'
: '/api/search';
return (
<RootProvider
search={{
options: {
api
}
}}
>
{children}
</RootProvider>
);
} How can I create a button on a page that will open the |
Beta Was this translation helpful? Give feedback.
Answered by
KamilDev
Jan 6, 2025
Replies: 1 comment
-
I believe this is the best approach: import { useSearchContext } from 'fumadocs-ui/provider';
const { setOpenSearch } = useSearchContext(); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
KamilDev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe this is the best approach: