Documentation / Feedback & overlays
Banner
A full-width banner for a message that concerns the whole page, in three variants:
"notification"(default): a status message coloured bytype(info, success, warning, error, neutral), with its icon androle="alert";"hero": a large centred title, on a dark background or a darkenedbackgroundImage;"promotion": a gradient line with abadge, for an offer or something new.
With closable, the cross hides the banner (the state is internal) then calls onClose: remember that choice yourself if the banner must not come back on the next load. For a transient message triggered by an action, prefer a Toast.
Examples
Notification
type gives the colour and the icon; description (or children) the text.
import { Banner } from "@synertech/ui";
export function Notification() {
return (
<Banner
type="info"
title="Maintenance prévue"
description="Le service sera indisponible dimanche de 2 h à 4 h."
/>
);
}The five types
A banner without a title shows its text directly.
import { Banner } from "@synertech/ui";
export function Types() {
return (
<div className="space-y-3">
<Banner type="default">Vous consultez une version archivée de ce document.</Banner>
<Banner type="info">Une nouvelle version de l’application est disponible.</Banner>
<Banner type="success">Votre domaine est vérifié.</Banner>
<Banner type="warning">Votre essai gratuit se termine dans 3 jours.</Banner>
<Banner type="error">La synchronisation a échoué : vérifiez vos identifiants.</Banner>
</div>
);
}Closable, with an action
closable adds the cross and onClose notifies you; action holds a button.
import { Banner, Button } from "@synertech/ui";
export function ClosableWithAction() {
return (
<Banner
type="warning"
title="Facture impayée"
description="Réglez la facture de mars pour conserver l’accès à votre espace."
closable
onClose={() => console.log("Bandeau masqué")}
action={<Button size="sm">Payer maintenant</Button>}
/>
);
}Hero
The title becomes a centred h2; backgroundImage is covered with a dark veil to keep the text readable.
import { Banner, Button } from "@synertech/ui";
export function Hero() {
return (
<Banner
variant="hero"
title="Pilotez vos projets en équipe"
description="Planning, tâches et documents réunis au même endroit."
backgroundImage="https://picsum.photos/1200/400"
action={<Button size="lg">Commencer gratuitement</Button>}
/>
);
}Full-width promotion
badge labels the offer; fullWidth removes the rounding to sit flush with the page edges.
import { Banner, Button } from "@synertech/ui";
export function Promotion() {
return (
<Banner
variant="promotion"
fullWidth
badge="Nouveau"
title="Les tableaux de bord arrivent"
description="Créez vos premiers graphiques en deux clics."
closable
action={
<Button size="sm" bgColor="bg-white hover:bg-gray-100" textColor="text-indigo-700">
Découvrir
</Button>
}
/>
);
}API reference
Components
import { Banner } from "@synertech/ui";Props — BannerProps
| Prop | Type | Default | Description |
|---|---|---|---|
action |
ReactNode |
— | |
backgroundImage |
string |
— | |
badge |
string |
— | |
children |
ReactNode |
— | |
closable |
boolean |
— | Draws a close button. A banner closed comes back when what it says changes — its type, title, description or text — where the next message never appeared. A message written as an element is not compared: give the banner a |
closeLabel |
string |
— | Accessible name of the close button. Defaults to the |
description |
ReactNode |
— | |
fullWidth |
boolean |
— | |
icon |
ReactNode |
— | |
onClose |
() => void |
— | |
title |
ReactNode |
— | |
type |
BannerType |
— | |
variant |
BannerVariant |
"notification" |
+ 277 inherited native attributes from HTMLAttributes, AriaAttributes, DOMAttributes (className, id, aria-*, event handlers…).
Types
BannerType
Typetype BannerType = "info" | "success" | "warning" | "error" | "default"BannerVariant
Typetype BannerVariant = "notification" | "hero" | "promotion"