You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@thijsvdanker/vue-fab

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thijsvdanker/vue-fab

Vue Floating Action Button

2.3.3
latest
Source
npmnpm
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

FAB

Floating Action Button for Vue.

The component supports multiple action buttons so you can add as many actions as you need. It will fire an event to the parent when clicking on each one.

Live Demo

Installation

npm install vue-fab --save

Dependencies

Include the following stylesheets on your document's head

<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

And

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">

Properties

PropertiesTypeValues
bg-colorStringDefault '#333333'
Accepts all color formats: HEX, RGB & RGBA
positionStringDefault 'bottom-left'
Options: 'bottom-left', 'bottom-right', 'top-left','top-right'
position-typeStringDefault 'fixed'
Options: 'fixed' or 'absolute'
z-indexStringDefault '999'
Set any value that suits your needs.
ripple-showBooleanDefault true
Options: true or false.
ripple-colorStringDefault 'light'
Options: 'light' or 'dark'.
icon-sizeStringDefault 'medium'
Options: 'small', 'medium' or 'large'.
main-iconStringDefault 'add'
Use icons from the material icon library.
main-tooltipStringDefault null
actionsArrayDetails bellow
fixed-tooltipBooleanDefault 'false'
if true, it shows the tooltip beside the actions
enable-rotationBooleanDefault 'true'
if true, the fab will rotate to indicate that it has been opened. Will not rotate if there are no actions specified.
start-openedBooleanDefault 'false'
if true, the fab will start opened.
toggle-when-awayBooleanDefault 'true'
if false, the fab will not be closed when clicking outside from the fab component.

actions

PropertiesTypeValues
nameStringName of the event
iconStringIcon name (Please refer to Material icons)
tooltipStringIf not used, tooltip won't appear.
colorStringDefault bg-color value
Accepts all color formats: HEX, RGB & RGBA

Examples

Include the component in your .vue file, actions prop is required for the component to work. The @event has to match the name given in the actions prop.

<template>
  <fab :actions="fabActions"
       @cache="cache"
       @alertMe="alert"
  ></fab>
</template>

Either color and position are set by default but they can be changed.

<fab
   :position="position"
   :bg-color="bgColor"
   :actions="fabActions"
   @cache="cache"
   @alertMe="alert"
></fab>

Match your data with your components props. The bgColor accepts either HEX, RBG or RGBA format.

Remember: Only material icons are accepted.

<script>
import fab from 'vue-fab'

export default {
  components: {
    fab
  },
   data(){
      return {
          bgColor: '#778899',
          position: 'top-right',
          fabActions: [
              {
                  name: 'cache',
                  icon: 'cached'
              },
              {
                  name: 'alertMe',
                  icon: 'add_alert'
              }
          ]
      }
  },
  methods:{
      cache(){
          console.log('Cache Cleared');
      },
      alert(){
          alert('Clicked on alert icon');
      }
  }
}
</script>

Keywords

vue

FAQs

Package last updated on 10 Jul 2020

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