Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrloop/ember-material-modifier
Lightweight emberjs material design integration
https://github.com/mrloop/ember-material-modifier
Last synced: 5 days ago
JSON representation
Lightweight emberjs material design integration
- Host: GitHub
- URL: https://github.com/mrloop/ember-material-modifier
- Owner: mrloop
- License: mit
- Created: 2022-02-02T20:31:18.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-03T22:30:11.000Z (11 days ago)
- Last Synced: 2024-11-03T23:22:13.691Z (11 days ago)
- Language: JavaScript
- Size: 1.04 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ember-material-modifier
[![Node CI](https://github.com/mrloop/ember-material-modifier/actions/workflows/ci.yml/badge.svg)](https://github.com/mrloop/ember-material-modifier/actions/workflows/ci.yml)
[![npm version](https://img.shields.io/npm/v/ember-material-modifier.svg)](https://www.npmjs.com/package/ember-material-modifier)Lightweight Ember.js material design integration.
An Ember add-on for [Material Component for web](https://github.com/material-components/material-components-web/).
## Compatibility
* Ember.js v3.20 or above
* Ember CLI v3.20 or above
* Node.js v12 or above## Installation
```
ember install ember-material-modifier
```## Usage
ember-material-modifier is designed to be as minimal and unobtrusive as possible. It only downloads the JavaScript and CSS of google material design components that you use.
### Button Example
For instance if you want to use `@material/button` install the package
```sh
npm install @material/button
```Have a look at the material design docs for the component https://github.com/material-components/material-components-web/tree/master/packages/mdc-button. Then copy the example html to one of your templates.
```hbs
```
Next you add the `ember-material-modifier` modifier `{{material}}`
```hbs
```
Event listeners are added as usual
```hbs
```
If you find yourself duplicating this HTML you can extract it to a component that suits your application.
_app/components/mdc-button.hbs_
```hbs
```
_app/templates/application.hbs_
```hbs
Text Button
```| :warning: WARNING |
|:---------------------------|
| Many of the material.io HTML examples use the [Material Icons google font](https://fonts.google.com/icons?selected=Material+Icons), you either need to [install the font](https://developers.google.com/fonts/docs/material_icons#setup_method_1_using_via_google_fonts) or edit the example HTML to use an [alternative](https://github.com/ivanvotti/ember-svg-jar). |### Register component
The `{{material}}` modifier takes two positional arguments. The first is the name of the material design component. For instance you want to use the package `@material/menu` then the modifier is `{{material 'menu'}}`. You can also pass a second arguement to register the instance of material design component class with your application code.
```hbs