2.2.0 • Published 5 years ago

vue-material-checkbox v2.2.0

Weekly downloads
427
License
MIT
Repository
github
Last release
5 years ago

Material design checkbox component for Vue

Demo ✅

Here is demo with all features

Breaking changes from v1

Rename plugin default name from checkbox to Checkbox

Use ❓

With npm

  • Install plugin
npm install vue-material-checkbox --save
  • Import to the component (recommended way)
// inside vue SFC
import Checkbox from 'vue-material-checkbox'
export default {
  components: {Checkbox}
}
  • Import to the app and add to the Vue (not recommended)
import { globalCheckbox } from 'vue-material-checkbox'
Vue.use(globalCheckbox)

Alternatively if component used with server-side-rendering Then import as follows below:

import { globalCheckbox } from '../node_modules/vue-material-checkbox/src/main'
// assuming  that you're one level higher than root folder where node modules is.
Vue.use(globalCheckbox)

In this case you will have to install stylus and stylus-loader to parse styles of component.

  • Use it as component:
<Checkbox id="mycheck1" v-model="someVar" :value="42">My Checkbox</Checkbox>

This component must be used with v-model to work properly. But you can pass any value to :value and get it from event change from second argument.

Component 💎

There is autogenerated id for label and checkbox, but you can specify it yourself.

You can specify label for checkbox inside checkbox tag:

<Checkbox id="mycheck1" v-model="someVar"> ThisIsLabel </Checkbox>

You can set custom color for background of checkbox:

<Checkbox id="mycheck1" v-model="someVar" color="#f50057"> ThisIsLabel </Checkbox>

You can set size of the box and label font size in pixels:

<Checkbox id="mycheck1" v-model="someVar" :size="32" fontSize="24"> ThisIsLabel </Checkbox>

Complete props table

PropTypeDefaultWhat For
idStringundefinedRecommended. input id associated with label
modelBoolean or ArrayundefinedValue for v-model
valueanyundefinedValue for input, without it checkbox works as true/false
colorStringundefinedPass the color string to change bg-color of checkbox
checkedBooleanfalseis checked by default?
nameStringundefinedName for input
requiredBooleanfalseHTML required attr
disabledBooleanfalseHTML disabled attr
sizeNumberundefinedSize of the box in px
fontSizeNumberundefinedSize of the label font in px
2.2.0

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

2.0.0-beta.0

5 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.9.3

6 years ago

0.9.2

6 years ago

0.9.1

6 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.3.0

7 years ago

0.1.0

7 years ago