Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-simple-drawer-csp

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-simple-drawer-csp

A tiny Drawer component for vue

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Codacy Badge codecov All Contributors Build Status Greenkeeper badge Known Vulnerabilities License: MIT npm FOSSA Status

vue-simple-drawer

TODO

  • remove shadow for default style
  • add cover layer option
  • rename the scss vars
  • nest drawer?

Install

npm install vue-simple-drawer --save

Quick Start

<template>
  <div id="app">
    <button @click="toggle">toggle</button>
    <Drawer @close="toggle" align="left" :closeable="true">
      <div v-if="open">content here</div>
    </Drawer>
  </div>
</template>

<script>
import Drawer from "vue-simple-drawer-csp"
import from "vue-simple-drawer-csp/dist/vue-simple-drawer.css"
export default {
  name: "app",
  data() {
    return {
      open: true
    }
  },
  components: {
    Drawer
  },
  methods: {
    toggle() {
      this.open = !this.open
    }
  }
}
</script>

Prop Types

PropertyTypeRequired?Description
alignStringOne of "left", "up", "right", "down", default is 'right'. the location of the drawer.
closeableBooleanshow the x - close button, default true
maskBooleanshow the mask layer - close button, default true
maskClosableBooleanemit 'close' event when click on mask layer, default: false
zIndexNumberz-index value for the drawer, the nest drawer's z-index will be increased automatically, default is 1000

Events

EventParamsRequired?Description
closeNonewill be triggered when user click the x close button

Slot

Slot NameDescription
defaultthe content display in the drawer which can show/hide the draw by v-if

Advance Guide

Nest Drawer
   <button @click="toggle">Open/Close</button>
    <Drawer @close="toggle" :align="align" :closeable="true">
      <div v-if="open">
        <span @click="innerOpen=true">
          content here
          content here
          content here
          content here
          content here
          content here
          content here
        </span>
        <Drawer @close="innerOpen=false" :align="align" :closeable="true">
          <div v-if="innerOpen">
            content here
            content here
            content here
          </div>
        </Drawer>
      </div>
    </Drawer>

    ...

      data() {
        return {
          open: false,
          innerOpen: false,
          align: "left"
        };
      },
Customized Theme
  • In your customized scss file (demo.scss)
$--simple-drawer-close-width: 50px;
@import "~vue-simple-drawer/src/index";
  • import the scss to override the default theme in main.js (entry file) after you import the Draw component
import "./demo.scss";

variables

close button style

  • $--simple-drawer-softorange
  • $--simple-drawer-tomatored
  • $--simple-drawer-mediumblu

close button size

  • $--simple-drawer-close-width

drawer background

  • $--simple-drawer-bg-color

drawer text color

  • $--simple-drawer-fg-color

License

FOSSA Status

Contributors

Thanks goes to these wonderful people (emoji key):

Vincent Guo
Vincent Guo

💻 📖 🚇

This project follows the all-contributors specification. Contributions of any kind welcome!

Keywords

FAQs

Package last updated on 23 Sep 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc