npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@papit/placement

v0.0.11

Published

Positions its content on a chosen side of an anchor element with CSS anchor positioning, with an optional arrow marker. Use it as the floating layer of tooltips, menus and popovers.

Readme

@papit/placement

Positions its content on a chosen side of an anchor element with CSS anchor positioning, with an optional arrow marker. Use it as the floating layer of tooltips, menus and popovers.

Logo


Type Tests NPM version


Installation

npm install @papit/placement

Needs a browser with CSS anchor positioning (anchor-name, position-area).


Usage

Import

import "@papit/placement";

Basic example

Name the anchor, then point the placement at it. By default it looks for --anchor below the anchor.

<button style="anchor-name: --anchor">Anchor</button>

<pap-placement>Shown below the button</pap-placement>

Pick a side

<button style="anchor-name: --save">Save</button>

<pap-placement placement="right-top" style="--anchor-name: --save">
  Saved 2 minutes ago
</pap-placement>

Setting position-anchor directly works too:

<pap-placement placement="top" style="position-anchor: --save">…</pap-placement>

With an arrow marker

The marker is a ::after arrow on the host, hidden by default. It inherits the host background.

pap-placement::after {
  display: block;
}

Attributes / Properties

| Attribute | Property | Type | Default | Description | | ----------- | ----------- | ----------- | ---------- | -------------------------------------------- | | placement | placement | Placement | "bottom" | Side of the anchor and alignment along it |

Placement is one of top, top-left, top-center, top-right, bottom, bottom-left, bottom-center, bottom-right, left, left-top, left-center, left-bottom, right, right-top, right-center, right-bottom. A bare side (top) is the same as its -center variant. The second word names the anchor edge the box lines up with: bottom-left starts at the anchor's left edge and grows right.


Slots

| Slot | Description | | --------- | --------------------------------------------------- | | (default) | The floating content | | marker | Custom marker content, wrapped in the marker part |


Styling

| Custom property | Default | Description | | ---------------- | --------------------------- | --------------------------------------------- | | --anchor-name | --anchor | Anchor name used for position-anchor | | --gap | var(--space-2, 8px) | Distance between the anchor and the box | | --marker-space | calc(-1 * var(--space-2) + 1px) | Offset of the ::after marker from the edge |

| Part | Description | | -------- | ----------------------------------- | | marker | Wrapper around the marker slot |

The host is position: absolute and width: max-content.


License

Licensed under the @Papit License 1.0 Copyright (c) 2024 Henry Pap (@onkelhoy)

Key points

  • ✅ Free to use in commercial projects
  • ✅ Free to modify and distribute
  • ✅ Attribution required
  • ❌ Cannot resell the component itself as a standalone product

See the LICENSE file for full details.


Related Components