npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pyt-materialize

v8.0.0-1

Published

An Angular wrap around Materialize library

Downloads

1

Readme

Why 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

Table of contents

Installation

The following commands will add ngx-materialize library to your package.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 using Angular-CLI you can follow the example below :

angular.json

"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"
],

tsconfig

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "module": "es2015",
    "types": [
+      "jquery",
+      "materialize-css"
    ]
  },
  "exclude": [
    "src/test.ts",
    "**/*.spec.ts"
  ]
}

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

Icons

Ngx-materialize offers two "out-of-the-box" options for icons although you are free to use the library of your choice.

Material Design Icons

To use Material Design Icons (community project based on Google Material Icons with lots of added icons), which is used with mz-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 using Angular-CLI you can follow the example below :

angular.json

"styles": [
  "src/styles.scss",
  "node_modules/materialize-css/dist/css/materialize.min.css",
+ "node_modules/@mdi/font/css/materialdesignicons.min.css"
],

Material Icons

To use Material Icons (official Google Material Icons library), which is used with mz-icon directive, you will need to add the following into the <head> tag of your index.html file:

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

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 { NoopAnimationsModule } from '@angular/platform-browser/animations';

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

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

Usage

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 { }

MaterializeModule deprecated

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 separate NgModule in your application that imports all the ngx-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 { }

Available features

Page listed in Native CCS Class will not be wrapped.

Components

  • 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

Services

  • Media

Demo application

A demo application is available at https://sherweb.github.io/ngx-materialize/, or refer to the ./demo 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.