Angular 2 - 14 components, directives and styles based on material design lite (npm: @angular-mdl/core)
Angular 15 components, directives and styles based on material design lite https://getmdl.io (v: 1.3.0). This package
assumes that you are building an Angular app with TypeScript. Angular CLI makes it even easier but isn’t required.
npm install @angular-mdl/core --save
You may include the material-design-lite css in your html and you’re done!
<link rel="stylesheet" href="https://code.getmdl.io/1.1.3/material.indigo-pink.min.css"/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
Under http://mseemann.io/angular2-mdl/theme you’ll find a customizing tool to change the theme colors.
This package includes the scss files from material-design-lite. With these files you are able to change the colors and
other variables in your own scss files:
@import "~@angular-mdl/core/scss/color-definitions";
$color-primary: $palette-blue-500;
$color-primary-dark: $palette-blue-700;
$color-accent: $palette-amber-A200;
$color-primary-contrast: $color-dark-contrast;
$color-accent-contrast: $color-dark-contrast;
@import "~@angular-mdl/core/scss/material-design-lite";
To make this working you need to find out the way how you could tell your build system where the scss is located. For
example with webpack you can use the special ~@angular-mdl/core
syntax used above. Or you can configure the
includePaths:
sassLoader: {
includePaths: [util.root('node_modules', '@angular-mdl/core', 'scss')]
}
Additional components for @angular-mdl/core that are not part of material design lite
Name | Provided By | Description | npm | documentation | status | demo |
---|---|---|---|---|---|---|
datepicker | mseemann | a simple date picker | readme | experimental | demo | |
expansion-panel | abdulqadir93 | organise arbitrary content in an expansion panel | readme | experimental | demo | |
fab-menu | leojpod | a fab menu component | readme | experimental | demo | |
popover | tb | popover with arbitrary content | readme | experimental | demo | |
select | tb | a select box | readme | experimental | demo |
These components support AOT and TreeShaking!
Install the components via npm. Please check out the individual readme for each component from the table above.
Starting with version 0.2.0 the components each have no css styles imported by default. You need to setup your build
pipeline to include the scss files from each component you want to use. This makes it possible to configure the theming
for the components you want to use.
If you are using webpack you may use the special webpack import syntax for node_modules:
@import '~@angular-mdl/core/scss/color-definitions';
$color-primary: $palette-blue-500;
$color-primary-dark: $palette-blue-700;
$color-accent: $palette-amber-A200;
$color-primary-contrast: $color-dark-contrast;
$color-accent-contrast: $color-dark-contrast;
@import '~@angular-mdl/core/src/scss-mdl/material-design-lite';
@import '~@angular-mdl/popover/popover';
@import '~@angular-mdl/select/select';
Another way is to include each component folder in the search path for your scss preprocessor. An example for webpack:
sassLoader: {
includePaths: [
'node_modules/@angular-mdl/popover',
'node_modules/@angular-mdl/select'
]
}
The coverage report is stored under: coverage/coverage-remap/index.html
Every contribution is welcome. Please checkout
the CONTRIBUTION.md file.
And if you would like to see a real world app that uses this package have a look
at https://www.yovelino.de/apps/tour-planner/.