Skip to content

Can I change the theme of navbar just for the homepage #826

Answered by fuma-nama
Gitstar-OC asked this question in Q&A
Discussion options

You must be logged in to vote

In provider.tsx:

'use client';
import { RootProvider } from 'fumadocs-ui/provider';
import { usePathname } from 'next/navigation';
import type { ReactNode } from 'react';
 
export function Provider({ children }: { children: ReactNode }) {
  const pathname = usePathname()

  return (
    <RootProvider theme={{ enabled: pathname !== '/' }}>
      {children}
    </RootProvider>
  );
}

And replace the root provider from root layout with your new one

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Gitstar-OC
Comment options

@fuma-nama
Comment options

Answer selected by Gitstar-OC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants