A prominent page or section message for announcements, promotions, and alerts. Dismissible by default, with optional CTAs and semantic tones.
DefaultRendered example
Limited Time Offer! Explore exclusive deals & savings
Usage Example
@banner.Banner(banner.Config{Description:"Limited Time Offer! Explore exclusive deals & savings",})
Persistent (Non-dismissible)
Persistent: true removes the dismiss control so the message stays put.
Persistent (Non-dismissible)Rendered example
This banner cannot be dismissed by users
Persistent (Non-dismissible)
@banner.Banner(banner.Config{Description:"This banner cannot be dismissed by users",Persistent:true,})
With CTA Button
Use Href for native navigation or HTMX for a server action, with optional OnClick for local enhancement.
With CTA ButtonRendered example
Get Fit Anywhere, Anytime 💪
With CTA Button
@banner.Banner(banner.Config{Description:"Get Fit Anywhere, Anytime 💪",CTA:&banner.CTAConfig{ActionLabel:"Start free trial",HTMX:&banner.HTMXConfig{Post:"/api/components/banner/action",Target:"#banner-cta-result",Swap:"innerHTML",},// Optional local enhancement after HTMX begins.OnClick:"trackTrialStart()",},})
Semantic Tones
Set Tone for semantic coloring: Default, Primary, Info, Success, Warning, or Danger.
Semantic TonesRendered example
Default tone banner
Primary tone for promotions
Info tone for general information
Success! Operation completed successfully
Warning: Please review your settings
Error: Something went wrong
Semantic Tones
@banner.Banner(banner.Config{Description:"Success! Your changes have been saved",Tone:banner.ToneSuccess})@banner.Banner(banner.Config{Description:"Warning: Please review your settings",Tone:banner.ToneWarning})
Cookie Consent
CookieBanner is a separate corner-anchored dialog with consent-specific content and accept/reject actions.
Cookie ConsentRendered example
🍪 Cookie Time!
We use cookies to make your experience sweet and crispy. For more information, please read our Privacy Policy.
Cookie Consent
@banner.CookieBanner(banner.CookieBannerConfig{Title:"Cookie Settings",Description:"We use cookies to improve your experience.",AcceptLabel:"Accept All",RejectLabel:"Decline",AcceptAction:"show = false",RejectAction:"show = false",})
Go API
v0.2.7
The examples above cover behavior and composition. pkg.go.dev is the canonical reference for exported types, functions, methods, and Go documentation.
Goshtoso can store preferences and demo state in your browser. Some examples use cookies and IndexedDB to persist local demo state. There is no analytics, advertising, or third-party tracking. You can use the site without storage, but preferences and some examples will reset or stop persisting. Details in our Privacy Policy.