2.3.1 • Published 6 years ago

vue-fab v2.3.1

Weekly downloads
457
License
MIT
Repository
github
Last release
6 years ago

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>
2.3.1

6 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.1.4

6 years ago

2.1.3

6 years ago

2.1.2

6 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.10

7 years ago

2.0.9

7 years ago

2.0.8

7 years ago

2.0.7

7 years ago

2.0.6

7 years ago

2.0.5

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.1

7 years ago