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

tiny-corner-ribbon

v1.0.1

Published

Add a framework-agnostic corner ribbon to your frontend.

Readme

tiny-corner-ribbon

フロントエンドの画面端に短いラベルを表示する、フレームワーク非依存の TypeScript ライブラリです。実装は DOM API と inline style のみで、React、Vue、Svelte、Next.js、Nuxt、Astro、Gatsby、CSS-in-JS、CSS フレームワークには依存しません。

devstagingpreview のような環境名だけでなく、betademonewinternal など任意の短いラベルに使えます。4つの角すべてに配置できます。

corner-ribbon screenshot

インストール

npm install tiny-corner-ribbon

基本的な使い方

import { mountCornerRibbon } from 'tiny-corner-ribbon'

mountCornerRibbon({
  text: 'beta',
  color: 'blue',
  position: 'left',
})

SSR を使うフレームワークでは、ブラウザ上で実行される lifecycle から呼び出してください。

script タグで使う

JavaScript bundler を使わない静的サイトでは、auto entry を script タグで読み込めます。

<script
  type="module"
  src="/path/to/tiny-corner-ribbon/dist/auto.js"
  data-text="beta"
  data-color="blue"
  data-position="left"
></script>

対応方針

同じ Vanilla API を、各 JavaScript frontend 環境のクライアント実行位置から呼び出します。フレームワーク専用 adapter は必要になるまで追加しません。Hugo のような静的サイトでは、script タグ経由で利用できます。

| 環境 | 使い方 | | --- | --- | | Vanilla | mountCornerRibbon を import、または auto script を使用 | | React | client-side effect から呼び出す | | Vue | onMounted から呼び出す | | Svelte | onMount から呼び出す | | Next.js | Client Component から呼び出す | | Nuxt | client-only plugin または mounted hook から呼び出す | | Astro | browser script から呼び出す | | Gatsby | gatsby-browser から呼び出す |

API

mountCornerRibbon(options)

リボンを作成して対象要素に追加します。同じ id のリボンがすでに存在する場合は、追加前に削除します。

createCornerRibbon(options)

DOM へ追加せず、リボン要素だけを作成します。

unmountCornerRibbon(options)

同じ id で mount されたリボンを削除します。

オプション

| Option | Default | Description | | --- | --- | --- | | text | 'label' | 表示するラベル | | position | 'left' | left, right, left-bottom, right-bottom | | color | 'blue' | プリセット色、または任意の CSS color | | textColor | auto | 文字色 | | target | document.body | mount 先の selector または element | | shadow | true | 可能な場合に Shadow DOM を使う | | dismissible | true | クリックでリボンを削除する | | id | 'corner-ribbon' | remount / unmount に使う識別子 | | zIndex | 9999 | リボンの z-index |