Installation
SV Layer provides six independent overlay primitives for Svelte. Install the package for your interaction, supply your markup, and use the optional theme or your own global surface styles.
Requirements
- Svelte 5.29 or newer is required for attachments.
- A browser with the native Popover API is required for top-layer surfaces. There is no equivalent positioning and interaction fallback for older browsers.
- Tooltip and Hovercard are hover/focus interactions. For touch actions, use Popover, Dropdown or Modal. Context Menu also supports long-press.
Choose a package
Compare all six interaction contracts before choosing a primitive.
pnpm add @sv-layer/tooltip The shared core is installed with each package. You do not need to install it separately.
Headless styling
The theme import in Quick start is optional. Remove it to style the surface yourself. Portaled surfaces are mounted separately, so scoped styles in the trigger component do not reach them. Set the configuration class and target it with a global selector; set CSS variables on the surface itself or a shared ancestor such as :root.
Dialog content needs an accessible name: provide label, or pass titleId and render a matching heading. Pass descriptionId only when that description exists. Keyboard and browser limitations are documented on each primitive page.