The Floating UI service is designed to create a flexible and dynamic floating DOM element that can be positioned relative to a reference element. It provides a set of options for customization, including positioning configuration, auto-updating behavior, and arrow styling.
The service uses a 3rd party library called floating UI.
By leveraging the provided directives and state stores, developers can easily integrate floating UI elements into their web applications with flexibility and control.
Use the createFloatingUI
function to create an instance of the Floating UI service.
Pass an optional propsConfig
parameter to customize the initial configuration.
The propsConfig
parameter allows you to provide initial values for the following options:
The Floating UI service exposes several state stores that represent different aspects of the UI position:
x$
: X-coordinate of the floating UI.y$
: Y-coordinate of the floating UI.strategy$
: Strategy used for positioning.placement$
: Placement of the floating UI.middlewareData$
: Additional data provided by middleware.Floating UI instance includes a patch
method that allows you to patch the configuration dynamically at runtime.