We use cookies to ensure you get the best experience on our website. Read our privacy policy

Skip to main content

Directory

Pop Banner Component

The Pop Banner component provides a flexible way to display temporary messages or notifications to users. It supports multiple positions, auto-dismiss functionality, and customizable content.

  • Check Circle

    Flexible Positioning: Left, right, or center alignment options

  • Check Circle

    Auto-dismiss: Optional timeout for automatic hiding

  • Check Circle

    Customizable Content: Supports any HTML content

  • Check Circle

    Animated: Smooth show/hide transitions

Create a basic pop banner with default settings:

<PopBanner>
<p>This is a pop banner message!</p>
</PopBanner>
<PopBanner>
<p>A centered pop banner with default styling</p>
</PopBanner>
<PopBanner position="left" timeout={5000}>
<p>This banner will auto-dismiss after 5 seconds</p>
</PopBanner>
Pop Banner Component Props
Prop Type Default Description
position 'left' | 'right' | 'center' center Position of the banner on the screen
timeout number undefined Time in milliseconds before auto-dismissing
showCloseButton boolean true Whether to show the close button

The Pop Banner component exposes methods for programmatic control:

// Show the banner
document.querySelector('pop-banner').toggle(true);
// Hide the banner
document.querySelector('pop-banner').toggle(false);
// Toggle the banner
document.querySelector('pop-banner').toggle();

The Pop Banner component emits custom events that you can listen to:

// Listen for the 'show' event
document.querySelector('pop-banner').addEventListener('show', () => {
console.log('Banner is visible');
});
Cookie Consent
Newsletter Signup
Account Verification

Limited Time Launch Sale

Add dynamic pop banners to your website with our AstroJS starter template. Get started now!

GET 60% OFF!
North Star Themes Logo

Subscribe to our newsletter

Get the latest AstroJS tips and tricks right to your inbox

Email: [email protected]

© 2025 North Star Themes

Web Kit Provided By North Star Themes