Create self-positioning popovers with native CSS—no JavaScript required. Made for Svelte 5. Build tooltips, dropdowns and any floating UI components.
Overview
AnchorPop is an innovative library designed to leverage the power of native CSS Anchor Positioning specifically for Svelte applications. This lightweight tool allows developers to create versatile UI components such as popovers, tooltips, dropdowns, and context menus that can self-adjust based on the available screen space. With its focus on simplicity and efficiency, AnchorPop aims to enhance user interaction without adding unnecessary complexity to your codebase.
One of the standout aspects of AnchorPop is its ability to intelligently position elements, ensuring a seamless integration into any application. Whether you’re designing an intricate dashboard or a straightforward form, AnchorPop helps streamline the process of creating dynamic and responsive components that enhance usability and aesthetics.
Features
- Pure CSS Positioning: Utilizes the native CSS Anchor Positioning API, ensuring optimal performance and style consistency without additional scripting.
- Automatic Fallbacks: When a popover doesn’t fit its primary position, the library automatically seeks alternative placement options, enhancing user experience.
- Visual Arrows: Optional arrows can be added to link the popover to its anchor, providing visual clarity on element relationships.
- Multiple Placements: Offers various positioning modes—outside, inside, overlay, and border—allowing for flexible customization depending on your design needs.
- Zero Dependencies: Built exclusively for Svelte 5, this library doesn’t require any external dependencies, simplifying your project setup.
- Dynamic Configuration: The AnchorPopConfig class allows for easy management of popover states and configurations, unlocking advanced customization capabilities.
- Browser Support: Fully supports modern browsers including Chrome and Edge, while Safari users should note limitations with visual arrows until feature support improves.