Fumadocs

Banner

Add a banner to your site

Be careful, Fumadocs v99 has released
Be careful, this banner can be closed

Usage

Put the element at the top of your root layout.

import { Banner } from 'fumadocs-ui/components/banner';
 
export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}): React.ReactElement {
  return (
    <html lang="en">
      <body>
        <Banner>Hello World</Banner>
        {children}
      </body>
    </html>
  );
}

Close

To allow users to close the banner, give the banner an ID.

import { Banner } from 'fumadocs-ui/components/banner';
 
<Banner id="hello-world">Hello World</Banner>;

The state will be automatically persisted.

Last updated on

On this page

Edit on Github