0.2.0 • Published 5 years ago

vue-loading-checkbox v0.2.0

Weekly downloads
17
License
MIT
Repository
-
Last release
5 years ago

A vue UI component for loading checkbox

How to install

npm install vue-loading-checkbox --save

How to use

Inside your .vue files

<template>
  <div id="your-component">
    <!-- Using Component -->
    <loading-checkbox
      :checked="checked"
      :loading="loading"
      label="Title of checkbox"
      @click.native="toggleStatus"
    />
  </div>
</template>
<script>
// Importing Component and style
import LoadingCheckbox from 'vue-loading-checkbox'
import 'vue-loading-checkbox/dist/LoadingCheckbox.css'

export default {
  name: 'YourComponentName',
  data() {
    return {
      checked: false,
      loading: false
    }
  },
  methods: {
    toggleStatus() {
      this.loading = true
      setTimeout(() => {
        this.loading = false
        this.checked = !this.checked
      }, 2000)
    }
  },
  components: {
    LoadingCheckbox // Registering Component
  }
}
</script>

Component props

propdescriptiondefault
borderColorColor of checkbox borderblack
borderRadiusBorder radius of checkbox0
borderStyleStyle of checkbox border, (solid, dashed, dotted, ...)solid
borderWidthwidth of checkbox border. You have to insert unit (px,em...)1px
checkColorColor of check markwhite
checkedStatus of component. can be true(checked) or false(unchecked)false
checkedBackgroundColorBackground color of checkbox when status is checkedgray
checkedBorderColorBorder color of checkbox when status is checkednull (same as borderColor)
checkedBorderRadiusBorder radius of checkbox when status is checkednull (same as borderRadius)
checkedBorderStyleBorder style of checkbox when status is checkednull (same as borderStyle)
checkedBorderWidthBorder width of checkbox when status is checkednull (same as borderWidth)
checkIconCustom check mark image (.svg, png, etc). you have to pass it with require functionnull A default pure css check
checkIconPaddingPadding of the given custom check mark image (This will not affect the size)null
fontColorText color of labelblack
fontSizeFont size of labelnull (calculated based on size)
gapGap size between checkbox and its label in px.null (calculated based on size)
labelLabel of checkboxnull (no label)
loadingIf true component is in loading state. it has a higher priority than checkedfalse
loadingBackgroundColorBackground color of checkbox when status is loadingwhite
loadingBorderColorBorder color of checkbox when status is loadingnull (same as borderColor)
loadingBorderRadiusBorder radius of checkbox when status is loadingnull (same as borderRadius)
loadingBorderStyleBorder style of checkbox when status is loadingnull (same as borderStyle)
loadingBorderWidthBorder width of checkbox when status is loadingnull (same as borderWidth)
sizeSize of component in px.30
spinnerColorColor of spinnerblack
spinnerRingColorColor of loading ringlightgray
uncheckedBackgroundColorBackground color of checkbox when status is uncheckedwhite
uncheckedBorderColorBorder color of checkbox when status is uncheckednull (same as borderColor)
uncheckedBorderRadiusBorder radius of checkbox when status is uncheckednull (same as borderRadius)
uncheckedBorderStyleBorder style of checkbox when status is uncheckednull (same as borderStyle)
uncheckedBorderWidthBorder width of checkbox when status is uncheckednull (same as borderWidth)

:warning: Warning: You have to v-bind custom icon path with require function:

v-bind:checkIcon="require(@/assets/path/to/icon.svg)" :heavy_check_mark:

:checkIcon="require(@/assets/path/to/icon.svg)" :heavy_check_mark:

checkIcon="@/assets/path/to/icon.svg" :x:

checkIcon="require(@/assets/path/to/icon.svg)" :x:

Contributing

Visit CONTRIBUTING Page

Project setup

npm install

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build-bundle

Lints and fixes files

npm run lint

License

MIT

0.2.0

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago