- Notifications
You must be signed in to change notification settings - Fork74
Angular wrap around Materialize library
License
sherweb/ngx-materialize
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Caution
This repoitory is unmaintained andshould not be used in production
This library is anAngular wrap aroundMaterialize library, a responsive CSS/JS framework that implements Material Design specifications from Google.
Demo and documentation :https://sherweb.github.io/ngx-materialize/
The main purpose of this library is to simplify the usage of Materialize within the Angular framework which make it more dynamic. To illustrate this, we have Playground sections in several component demo pages.
In other words, we ...
- Simplify components usage
- Initialize components automatically
- Handle Angular "quirks" with Materialize library
- Offer component injection when possible
- Provide a MediaService that allow customization according to view port size
- Add support for ReactiveForm with validation
The following commands will add ngx-materialize library to yourpackage.json
file along with its dependencies: Materialize CSS and jQuery.
npm install --save ngx-materialize
Don't forget to include Materialize and jQuery in your application.
If you are usingAngular-CLI you can follow the example below :
"styles": [ "src/styles.scss",+ "node_modules/materialize-css/dist/css/materialize.min.css"],"scripts": [+ "node_modules/jquery/dist/jquery.min.js",+ "node_modules/materialize-css/dist/js/materialize.min.js"],
{ "extends": "../tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/app", "module": "es2015", "types": [+ "jquery",+ "materialize-css" ] }, "exclude": [ "src/test.ts", "**/*.spec.ts" ]}
See alsoAngular CLI 3rd Party Library Installation andUsing MaterializeCSS with your Angular 2 Angular CLI App.
Ngx-materialize offers two "out-of-the-box" options for icons although you are free to use the library of your choice.
To useMaterial Design Icons (community project based on Google Material Icons with lots of added icons), which is used withmz-icon-mdi
directive, you will need to add the library with the following command:
npm install --save @mdi/font
Don't forget to include Mdi library to your application.
If you are usingAngular-CLI you can follow the example below :
"styles": [ "src/styles.scss", "node_modules/materialize-css/dist/css/materialize.min.css",+ "node_modules/@mdi/font/css/materialdesignicons.min.css"],
To useMaterial Icons (official Google Material Icons library), which is used withmz-icon
directive, you will need to add the following into the<head>
tag of yourindex.html
file:
<linkhref="https://fonts.googleapis.com/icon?family=Material+Icons"rel="stylesheet">
Some components are using advance animation transition. You need to install@angular/animations
and includeBrowserAnimationsModule
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 includeNoopAnimationsModule
.
import { CommonModule } from '@angular/common';import { NgModule } from '@angular/core';+ import { NoopAnimationsModule } from '@angular/platform-browser/animations';import { AppModule } from './app.module';@NgModule({ imports: [+ NoopAnimationsModule, ],})export class AppModule { }
You must import component module you want to use inside your module to be able to use Materialize components.
import { CommonModule } from '@angular/common';import { NgModule } from '@angular/core';+ import { MzButtonModule, MzInputModule } from 'ngx-materialize';import { HomeComponent } from './home.component';@NgModule({ imports: [ CommonModule,+ MzButtonModule,+ MzInputModule, ], declarations: [ HomeComponent ],})export class HomeModule { }
We will continue to maintain this module for a period of time to allow you to migrate your existing components to the new way.We recommend to use the new component modules when you are building new component/application.
If you still want to import only one module, you can create a separateNgModule
in your application that imports all thengx-materialize
components. You will be able to include this module anywhere you like to use the components.
import { MzInputModule, MzValidationModule } from 'ngx-materialize';@NgModule({ imports: [ MzInputModule, MzValidationModule, ], exports: [ MzInputModule, MzValidationModule, ],})export class CustomMaterializeModule { }
Page listed inNative CCS Class will not be wrapped.
- Badge
- Button
- Card
- Checkbox
- Chip
- Collapsible
- Collection
- Datepicker
- Dropdown
- Feature discovery
- Form validation
- Icon
- Input
- Modal
- Navbar
- Pagination
- Parallax
- Progress
- Radio-Button
- Select
- Sidenav
- Spinner
- Switch
- Tab
- Textarea
- Timepicker
- Toast
- Tooltip
- Media
A demo application is available athttps://sherweb.github.io/ngx-materialize/, or refer to the./demo
folder and itsREADME.
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.
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!
Thanks toAli Mohammadi for donating the npm package name.
About
Angular wrap around Materialize library
Topics
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.