
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
placement.js
Advanced tools
A tiny library for positioning overlays. Useful for tooltips, popovers etc.
A tiny library for positioning overlays. Useful for tooltips, popovers etc.
Why? Positioning UI overlays like popovers and tooltips can be challenging. If you position them with CSS, then at some stage you are likely to run into problems with z-indices, parent overflows, or content going off the edge of the screen. JavaScript to the rescue!
Placement.js addresses a single use-case: positioning an overlay to one side of an anchor element, optimizing the placement depending on the size of the overlay:
Small filesize is a priority for Placement.js so that it can be included in web components. For a more powerful, configurable library, check out Popper.js.
npm install placement.js --save
import { place } from 'placement.js';
place(
anchor: HTMLElement,
overlay: HTMLElement,
options?: Options
);
type Options = {
placement?: Placement // defaults to 'bottom'
};
type Placement =
| 'top'
| 'top-start'
| 'top-end'
| 'bottom'
| 'bottom-start'
| 'bottom-end'
| 'right'
| 'right-start'
| 'right-end'
| 'left'
| 'left-start'
| 'left-end';
Check out the demo to see it in action.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
[1.0.0-beta.3] - 2021-03-02
place
function instead of a default
export.anchor
and overlay
arguments is swapped.side
and align
parameters have been combined into a single placement
option.[data-placement]
attribute selector.fixed
option.bound
option.Coordinates
or Range
as the anchor.FAQs
A tiny library for positioning overlays. Useful for tooltips, popovers etc.
The npm package placement.js receives a total of 747 weekly downloads. As such, placement.js popularity was classified as not popular.
We found that placement.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.