Coder Social home page Coder Social logo

trendingtechnology / vue3-popper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from valgeirb/vue3-popper

0.0 1.0 0.0 4.59 MB

A Vue.js popover component based on PopperJS

Home Page: https://valgeirb.github.io/vue3-popper

License: MIT License

JavaScript 46.67% Vue 53.33%

vue3-popper's Introduction

vue3-popper

A popover component for Vue 3

Documentation

Check out the documentation

Install

NPM

npm install vue3-popper

Yarn

yarn add vue3-popper

Usage

Vue environment

<!-- If your content is only a simple string, you can use the content prop: -->
<template>
  <Popper content="This is the Popper content">
    <button>Trigger element</button>
  </Popper>
</template>

<!-- If your content is more complex, you can use the content slot: -->
<template>
  <Popper>
    <button>Trigger element</button>
    <template #content>
      <div>This is the Popper content</div>
    </template>
  </Popper>
</template>

<script>
  import { defineComponent } from "vue";
  import Popper from "vue3-popper";

  export default defineComponent({
    components: {
      Popper,
    },
  });
</script>

Props

Name Default Description
placement bottom Preferred placement of the Popper
disableClickAway false Disables automatically closing the Popper when the user clicks away from it
offsetSkid 0 Offset in pixels along the trigger element
offsetDistance 12 Offset in pixels away from the trigger element
hover false Trigger the Popper on hover
arrow false Display an arrow on the Popper
arrowPadding 0 Stop arrow from reaching the edge of the Popper (in pixels)
disabled false Disables the Popper. If it was already open, it will be closed.
openDelay 0 Open the Popper after a delay (ms)
closeDelay 0 Close the Popper after a delay (ms)
interactive true If the Popper should be interactive, it will close when clicked/hovered if false
content null If your content is just a simple string, you can pass it as a prop

Events

Name Description
open:popper When the Popper is open
close:popper When the Popper is hidden

Slots

Name Description
content For the Popper content

Slot props

The content slot gives you access to useful variables and functions.

Name Type Description
close function A function to close the Popper
isOpen boolean The open state of the Popper

CSS variables

Popper only comes with some barebones styling by default, but it also uses a list of predefined CSS variables. You can overwrite these variables to suit your needs.

CSS variable Example value
--popper-theme-background-color #ffffff
--popper-theme-background-color-hover #ffffff
--popper-theme-text-color inherit
--popper-theme-border-width 1px
--popper-theme-border-style solid
--popper-theme-border-color #eeeeee
--popper-theme-border-radius 6px
--popper-theme-padding 16px
--popper-theme-box-shadow 0 6px 30px -6px rgba(0, 0, 0, 0.25)

vue3-popper's People

Contributors

valgeirb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.