Git Product home page Git Product logo

ng2-materialize's Introduction

ng2-materialize

This library is an Angular 2+ wrap around Materialize library, a responsive CSS/JS framework that implements Material Design specifications from Google.

The purpose of this library is to simplify the usage within the Angular framework.

Demo and documentation : https://sherweb.github.io/ng2-materialize/

Why ng2-materialize?

We are aware that alternatives exposing Material Design components already exist. But, in our case, we want to rely on a stable css framework that does not depend on a specific js framework.

We already know the possibilities Materialize offers. What is left to do is to wrap components that we want to use in Angular component.

If you want to use a component that is not yet implemented, simply wrap the existing Materialize components that already meets the Material Design specifications. No need to be an HTML/CSS expert, only to know the Angular 2+ components. Or if you are in a hurry, you can use it directly in HTML rather than in Angular component.

Installation

The following commands will add Ng2-Materialize library to your package.json file along with it dependencies: Materialize CSS, jQuery and Mdi (Mdi icons library is optional as your are free to use the icon library of your choice).

npm install --save ng2-materialize
npm install --save mdi    #optional

Don't forget to include jQuery, Materialize, and Mdi in your application.

If you are using Angular-CLI you can follow the example below :

.angular-cli.json

"styles": [
  "styles.scss",
+ "../node_modules/materialize-css/dist/css/materialize.min.css",
+ "../node_modules/mdi/css/materialdesignicons.min.css"   #optional
],
"scripts": [
+ "../node_modules/jquery/dist/jquery.min.js",
+ "../node_modules/materialize-css/dist/js/materialize.min.js"
],

tsconfig

{
  "compilerOptions": {
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "es2016",
      "dom"
    ],
    "outDir": "../out-tsc/app",
    "target": "es5",
    "module": "es2015",
    "baseUrl": "",
    "types": [
+      "jquery",
+      "materialize-css"
    ]
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

See also Angular CLI 3rd Party Library Installation and Using MaterializeCSS with your Angular 2 Angular CLI App.

Animation

Some components are using advance animation transition. You need to install @angular/animations and include BrowserAnimationsModule if you want those animation to work.

npm install --save @angular/animations
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { AppModule } from './app.module';

@NgModule({
  imports: [
+    BrowserAnimationsModule,
  ],
})
export class AppModule { }

If you don't want to install a new dependency in your application, you can include NoopAnimationsModule.

import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { AppModule } from './app.module';

@NgModule({
  imports: [
+    NoopAnimationsModule,
  ],
})
export class AppModule { }

Usage

You must import MaterializeModule inside your module to be able to use Materialize components.

import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
+ import { MaterializeModule } from 'ng2-materialize';

import { HomeComponent } from './home.component';

@NgModule({
  imports: [
    CommonModule,
+    MaterializeModule.forRoot(),
  ],
  declarations: [ HomeComponent ],
})
export class HomeModule { }

Available features

Page listed in Native CCS Class will not be wrapped.

Components

  • Badge
  • Button
  • Card
  • Checkbox
  • Collapsible
  • Collection
  • Datepicker
  • Dropdown
  • Form validation
  • Icon
  • Input
  • Modal
  • Navbar
  • Parallax
  • Progress
  • Radio-Button
  • Select
  • Sidenav
  • Spinner
  • Switch
  • Tab
  • Textarea
  • Timepicker
  • Toast
  • Tooltip

Services

  • Media

Demo application

A demo application is available at https://sherweb.github.io/ng2-materialize/, or refer to the ./demo-app folder and its README.

Road map

We (at SherWeb) are currently wrapping the components as we need them, and unfortunately, we cannot provide a specific road map.

If some components are missing, feel free to contribute.

Contribute

Contributions are always welcome.

Make sure that :

  • Your code style matches with the rest of the project
  • Unit tests pass
  • Linter passes

And you are ready to go!

Credits

Thanks to Ali Mohammadi for donating the npm package name.

ng2-materialize's People

Contributors

jfcere avatar charpeni avatar scote avatar mrmartinroy avatar blalonde avatar florianmrz avatar dotboris avatar darkisdude avatar gagaro avatar liadidan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.