apps/eclipse/content/design-system/components/banner.mdx
import { Banner } from "@prisma/eclipse";
Basic Banner
import { Banner } from "@prisma/eclipse";
export function BasicBanner() {
return <Banner description="Welcome to our documentation!" />;
}
With Icon
import { Banner } from "@prisma/eclipse";
export function BannerWithIcon() {
return (
<Banner
description="Important announcement: New features are available!"
showIcon
/>
);
}
Live Example:
<div className="not-prose"> <Banner description="Important announcement: New features are available!" showIcon changeLayout={false} /> </div>Color Variants
import { Banner } from "@prisma/eclipse";
export function ColoredBanners() {
return (
<>
<Banner color="default" description="Default banner" showIcon />
<Banner color="ppg" description="PPG branded banner" showIcon />
<Banner color="orm" description="ORM branded banner" showIcon />
<Banner color="error" description="Error or critical message" showIcon />
<Banner color="success" description="Success message" showIcon />
<Banner color="warning" description="Warning message" showIcon />
<Banner color="gradient" description="Gradient banner" showIcon />
</>
);
}
Live Examples:
<div className="not-prose space-y-4"> <Banner color="default" description="Default banner" showIcon changeLayout={false} /> <Banner color="ppg" description="PPG branded banner" showIcon changeLayout={false} /> <Banner color="orm" description="ORM branded banner" showIcon changeLayout={false} /> <Banner color="error" description="Error or critical message" showIcon changeLayout={false} /> <Banner color="success" description="Success message" showIcon changeLayout={false} /> <Banner color="warning" description="Warning message" showIcon changeLayout={false} /> <Banner color="gradient" description="Gradient banner" showIcon changeLayout={false} /> </div>Dismissible Banner
When you provide an id prop, the banner becomes dismissible and remembers the user's preference (via localStorage).
import { Banner } from "@prisma/eclipse";
export function DismissibleBanner() {
return (
<Banner
id="promo-banner"
color="ppg"
description="Limited time offer: Get started today!"
showIcon
/>
);
}
Live Example:
<div className="not-prose"> <Banner id="promo-banner" color="ppg" description="Limited time offer: Get started today!" showIcon changeLayout={false} /> </div>description - The text content to display in the banner (string, required)color - Color variant: "default", "ppg", "orm", "error", "success", "warning", or "gradient" (optional, default: "default")showIcon - Whether to show the info icon (boolean, default: false)id - Unique ID for the banner, enables dismissal with localStorage persistence (string, optional)changeLayout - Whether to automatically adjust layout height when banner is shown/hidden (boolean, default: true)height - Custom height for the banner (string, default: "3rem")className - Additional CSS classes (optional)id is provided)color="error" for critical announcements or system-wide issuescolor="warning" for important but non-critical informationcolor="success" for positive announcements or confirmationscolor="ppg" or color="orm" for product-specific announcementsid for banners that users should be able to dismissdescription text concise and actionableshowIcon to draw attention to important messages