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 🙏

© 2024 – Pkg Stats / Ryan Hefner

popper-vue

v0.1.8

Published

`popper-vue` neatly and snugly implements Popper.js into a simple `<Popper>` component that you can use to wrap it's children inside of a popper around an anchor element in your Vue applications. - **Render whatever you want:** Utilize the render callback

Downloads

1,425

Readme

🌟 Features

popper-vue neatly and snugly implements Popper.js into a simple <Popper> component that you can use to wrap it's children inside of a popper around an anchor element in your Vue applications.

  • Render whatever you want: Utilize the render callback to create entirely custom poppers.
  • Functional default styles: Import the provided css for some nice styling defaults or write your own styles.
  • Portal your poppers anywhere in the DOM: You can use a portal element to render your popper, or if you want to yet, use direct child.

Codesandbox Demo

⚡️ Installation

$ npm install popper-vue popper.js

Please note that popper-vue assumes that you already have Vue.js installed in your application. If you not have Vue installed. Install it by running npm install vue --save

Global Popper registration

In your main.js:

import { Popper } from 'popper-vue'
import 'popper-vue/dist/popper-vue.css'

Vue.component('Popper', Popper)

Local Popper import

In your templates:

<template>
  <div id="app">
    <button ref="anchorEl" @click="showPopper">Toggle portal</button>
    <Popper
      :is-open="show"
      :anchor-el="$refs.anchorEl"
      :on-close="hidePopper"
    >
      <aside id="popper-content">
        I am a Happy Popper 😀
      </aside>
    </Popper>
  </div>
</template>

<script lang="js">
import { Popper } from 'popper-vue'
import 'popper-vue/dist/popper-vue.css'

export default {
  name: 'App',
  components: {
    Popper
  },
  data () {
    return {
      show: false
    }
  },
  methods: {
    showPopper () {
      this.show = !this.show
    },
    hidePopper () {
      this.show = false
    }
  }
}
</script>

🏋🏼‍♀️ API

popper-vue provides a few components that allow to render custom popper components.

✅ - Completed! ⚠️ - WIP

🧤 Props

| Props | Description | Values | Default | | :------------- |-------------| ----- | --- | | ✅anchorEl | Anchor element around which popper is positioned | HTMLElement | N/A | | ✅ placement | Default position where popperEl should be placed when Popper is open | top, right, bottom, left | bottom | | ✅ modifiers | Modifier options for popper.js. See popper.js docs for more information | Object | {} | | ✅ isOpen | Determines whether the Popper is open or not | Boolean | false | | ✅ onClose | Handler function to be called when the popper is to be closed | Function | null | | ✅closeOnClickAway | Determines whether popper should close when other elements are clicked | Boolean | true | | ⚠️ usePortal | Determines whether popper should mount popperEl in portal before positioning it around anchor. | Boolean | false | | ✅ hasArrow | Determines whether popper should possess arrow when shown | Boolean | true |

📅 Events

| Events | Description | Payload | | ------------- |---------------| ----- | | ✅ popper:create | Emitted when popperEl is open and has been mounted by popper.js | { el: popperEl<HTMLElement> } | | ✅ popper:update | Emitted when Popper.js instance undergoes an update | { el: HTMLElement } | | ✅ popper:close | Emitted when popperEl is closed and has been unmounted by popper.js | {} |

⚠️ Caveats

  • The popper:close event is sometimes emitted twice when the popper is being closed when the closeOnClickAway props is truthy. Currently there are no implemented workarounds for this yet, so while using this component make sure to be careful of it. It's also worth pointing out that this may not be that big of a problem for most consumer use cases

📚TODO

  • [x] Publish to NPM
  • [ ] Upgrade to @popperjs/core support
  • [ ] Finish Popper Portal implementation
  • [ ] Create usePopper utility plugin funciton hook
  • [ ] Docs site
  • [ ] Codesandbox examples
  • [ ] Articles to illustrate how to use popper-vue in component library
  • [ ] Type declaration files for plugin

🦑 Contributors

🤝 Contributing

Here's our contribution guide.

❤️ Support this project

If you like this project, please consider supporting it by buying my a coffee!