Popups
Create floating menus and tooltips using Floating UI.
import { popup } from '@skeletonlabs/skeleton';
import type { PopupSettings } from '@skeletonlabs/skeleton';
Demo
Getting Started
Install Floating UI from NPM. This is required.
npm install @floating-ui/dom
Import Floating UI into your application's root layout /src/routes/+layout.svelte
.
import { computePosition, autoUpdate, flip, shift, offset, arrow } from '@floating-ui/dom';
Then import storePopup
in your root layout as well.
import { storePopup } from '@skeletonlabs/skeleton';
Finally, pass an object containing each of the Floating UI modules to the store.
storePopup.set({ computePosition, autoUpdate, flip, shift, offset, arrow });
Popup Settings
Reference the available placement options. This setting defaults to bottom
.
let popupSettings: PopupSettings = {
placement: 'bottom'
};
Combobox
By combining popups and Skeleton listboxes we can create a functional combobox element.
Browser Support
Please be aware that there is a z-index bug for popups rendered over elements using backdrop-blur
in some browsers. The
popup will appear to be rendered behind the blurred element, even with an elevated z-index.
Accessibility
We recommend you favor the click
event for mobile devices, as hover
is not well supported.