vue-material/README.md

128 lines
4 KiB
Markdown
Raw Normal View History

2016-06-17 23:32:39 +00:00
# Vue.js Material
2016-07-13 05:00:31 +00:00
> Material Design for Vue.js
2016-06-17 23:32:39 +00:00
2016-10-14 14:30:38 +00:00
Vue Material is lightweight framework built exactly according to the <a href="http://material.google.com" target="_blank">Material Design</a> specs. It aims to deliver a collection of reusable components and a series of UI Elements to build applications with support to <a href="https://saucelabs.com/u/vuejs" target="_blank">modern Web Browsers</a> through Vue 2.0. Build powerful and well-designed web apps that can can fit on every screen. You can generate and use themes dynamically, use components on demand, take advantage of UI Elements and Components with an ease-to-use API.
2016-10-14 14:25:29 +00:00
## Demo and Documentation
2016-10-17 07:06:35 +00:00
<a href="https://marcosmoura.github.io/vue-material/" target="_blank">Demo</a>
2016-10-17 02:19:23 +00:00
## Installation
Import Roboto and Google Icons from Google CDN:
``` html
2016-10-24 03:13:27 +00:00
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
```
2016-10-17 02:19:23 +00:00
Install Vue Material through npm or yarn
``` bash
npm install --save vue-material
yarn add vue-material
```
<small>* Others package managers like JSPM and Bower are not supported yet.</small>
2016-10-17 02:19:23 +00:00
Import or require Vue and Vue Material in your code:
``` javascript
import Vue from 'vue'
import VueMaterial from 'vue-material'
import 'vue-material/dist/vue-material.css'
// OR
2016-10-24 04:59:17 +00:00
var Vue = require('vue')
var VueMaterial = require('vue-material')
require('vue-material/dist/vue-material.css')
```
Alternativelly you can <a href="https://github.com/marcosmoura/vue-material/archive/master.zip" target="_blank" rel="noopener">download</a> and reference the script and the stylesheet in your HTML:
2016-10-17 02:19:23 +00:00
``` html
<link rel="stylesheet" href="path/to/vue-material.css">
<script src="path/to/vue-material.js"></script>
```
## Usage
2016-10-17 02:19:23 +00:00
Enable Vue Material in your application using ```Vue.use()```. You can always enable individual components:
``` javascript
Vue.use(VueMaterial)
2016-10-17 02:19:23 +00:00
// OR
Vue.use(VueMaterial.mdCore) //Required to boot vue material
Vue.use(VueMaterial.mdButton)
Vue.use(VueMaterial.mdIcon)
Vue.use(VueMaterial.mdSidenav)
Vue.use(VueMaterial.mdToolbar)
2016-10-17 02:19:23 +00:00
```
To get Vue Material working properly, you'll need to configure and apply a default theme.
``` javascript
Vue.material.theme.register('default', {
primary: 'cyan',
accent: 'pink'
})
2016-10-17 02:19:23 +00:00
```
Or you can register multiple themes at once.
``` javascript
Vue.material.theme.registerAll({
default: {
primary: 'cyan',
accent: 'pink'
},
phone: {
primary: 'indigo',
accent: 'pink'
}
})
2016-10-17 06:37:09 +00:00
```
Apply your theme using <code>v-md-theme</code> directive:
``` html
<div v-md-theme="'default'"></div>
<div v-md-theme="'phone'"></div>
```
## Changelog
2016-10-17 07:06:35 +00:00
<a href="https://marcosmoura.github.io/vue-material/#/changelog" target="_blank">Changelog</a>
2016-10-17 02:19:23 +00:00
2016-07-13 05:00:31 +00:00
## Build Setup
2016-06-17 23:32:39 +00:00
2016-07-13 05:00:31 +00:00
``` bash
2016-10-14 14:25:29 +00:00
### Install dependencies
2016-10-17 02:19:23 +00:00
npm install
yarn
2016-06-17 23:32:39 +00:00
2016-10-14 14:25:29 +00:00
### Start dev server with hot reload
2016-07-13 05:00:31 +00:00
npm run dev
2016-10-14 14:25:29 +00:00
### Build everything
2016-07-13 05:00:31 +00:00
npm run build
2016-10-14 14:25:29 +00:00
### Build docs only
npm run build:docs
2016-07-13 05:00:31 +00:00
2016-10-14 14:25:29 +00:00
### Build lib only
npm run build:lib
2016-07-13 05:00:31 +00:00
```
2016-10-14 14:25:29 +00:00
## Credits and Thanks
2016-10-17 02:19:23 +00:00
* This library aims to delivery components using almost the same API of <a href="https://material.angularjs.org/latest/" target="_blank">Angular Material</a>
2016-10-25 07:09:44 +00:00
* Thanks a lot to <a href="https://github.com/elviskang" target="_blank">elviskang</a> for donating the npm package name!
2016-10-17 02:19:23 +00:00
* Thanks to <a href="https://github.com/yyx990803" target="_blank">Evan You</a> for allowing me to use Vue.js Logo.
2016-10-14 14:25:29 +00:00
2016-10-17 02:19:23 +00:00
## Internal Dependencies
You don't need to include any other library to work with vue-material. The focus of this project is to have a standalone build with no external dependence, but aiming to deliver the best experience without break the compatibility with the Vue.js core.
2016-10-14 14:30:38 +00:00
* <a href="http://www.jacklmoore.com/autosize/" target="_blank">autosize</a>
* <a href="https://www.npmjs.com/package/element.scrollintoviewifneeded-polyfill" target="_blank">element.scrollintoviewifneeded-polyfill</a>
* <a href="https://github.com/lazd/scopedQuerySelectorShim" target="_blank">scopedQuerySelectorShim</a>
2016-10-14 14:42:59 +00:00
## License
MIT