The AppSloth Banner component allows you to display important messages to your users across your application. These banners can be informational alerts, announcements, or error notifications.Adding the Banner component to your application is simple:
Copy
// app/layout.js or app/layout.tsximport { AppSlothProvider } from 'appsloth/provider';import { Banner } from 'appsloth/banner';export default function RootLayout({ children }) { return ( <html lang="en"> <body> <AppSlothProvider userEmail="[email protected]" customerId="project-123" > <main className="flex w-full flex-col"> <Banner /> {children} </main> </AppSlothProvider> </body> </html> );}
Position your Banner component strategically for optimal user visibility. The
most common placement is at the top of your application, just above the
navigation bar.
The Banner component provides a simple yet powerful way to display messages to your users:
Automatic Configuration: The component automatically fetches banner configurations from AppSloth’s servers
Smart Display: The banner remains hidden unless there’s an active banner configured for the current page
Path-Based Display: Banners only appear on the paths you specify in the dashboard
User Interaction: If a link is provided, users can click on the banner to navigate to the specified URL
Multiple Variants: Choose between different styles (info, error) to match the type of message
Copy
import { Banner } from 'appsloth/banner';// The simplest implementation - the component handles everything automatically<Banner />// You can also add it to a specific section of your layout<main className="flex w-full flex-col"> <Banner /> <div className="flex w-full justify-end px-12 py-1"> {/* Your content */} </div></main>