Giter Site home page Giter Site logo

johan-gorter / material-components-web Goto Github PK

View Code? Open in Web Editor NEW

This project forked from material-components/material-components-web

0.0 2.0 0.0 50.94 MB

Modular and customizable Material Design UI components for the web

Home Page: https://material.io/components/

License: Apache License 2.0

JavaScript 65.73% CSS 32.98% Shell 1.28%

material-components-web's Introduction

Build Status codecov Chat

Material Components for the web

Material Components for the web (MDC-Web) help developers execute Material Design. Developed by a core team of engineers and UX designers at Google, these components enable a reliable development workflow to build beautiful and functional web projects.

Material Components for the web is the successor to Material Design Lite, and has 3 high-level goals:

  • Production-ready components consumable in an a-la-carte fashion
  • Best-in-class performance and adherence to the Material Design guidelines
  • Seamless integration with other JS frameworks and libraries

MDC-Web strives to seamlessly incorporate into a wider range of usage contexts, from simple static websites to complex, JavaScript-heavy applications to hybrid client/server rendering systems. In short, whether you're already heavily invested in another framework or not, it should be easy to incorporate Material Components into your site in a lightweight, idiomatic fashion.

Demos (updated with every release)

Quick start

Install the library

npm install --save material-components-web

Then simply include the correct files, write some HTML, and call mdc.autoInit() within a closing <script> tag.

<!DOCTYPE html>
<html class="mdc-typography">
  <head>
    <title>Material Components for the web</title>
    <link rel="stylesheet"
          href="node_modules/material-components-web/dist/material-components-web.css">
  </head>
  <body>
    <h2 class="mdc-typography--display2">Hello, Material Components!</h2>
    <div class="mdc-textfield" data-mdc-auto-init="MDCTextfield">
      <input type="text" class="mdc-textfield__input" id="demo-input">
      <label for="demo-input" class="mdc-textfield__label">Tell us how you feel!</label>
    </div>
    <script src="node_modules/material-components-web/dist/material-components-web.js"></script>
    <script>mdc.autoInit()</script>
  </body>
</html>

That's all there is to it! This is the easiest way to get up and running with Material Components for web. Check out our Getting Started guide for a more in-depth introduction to the library.

Installing individual components

MDC-Web is modular by design. Each component lives within its own packages under the @material npm org.

npm install --save @material/button @material/card @material/textfield @material/typography

All our components can be found in the packages directory. Each component has a README documenting installation and usage.

Including components

JavaScript

If you are using a module loader such as Webpack or SystemJS to load your JS modules, you can simply import every component you need from material-components-web and use it as such.

import {checkbox as mdcCheckbox} from 'material-components-web';

const {MDCCheckbox, MDCCheckboxFoundation} = mdcCheckbox;
// Use MDCCheckbox and/or MDCCheckboxFoundation

You can do the same with individual components

import {MDCCheckbox, MDCCheckboxFoundation} from '@material/checkbox';
// Use MDCCheckbox and/or MDCCheckboxFoundation

We also provide UMD bundles for both material-components-web as well as all individual components.

const {checkbox: mdcCheckbox} = require('material-components-web/dist/material-components-web');
// Use mdcCheckbox

const {MDCCheckbox, MDCCheckboxFoundation} = require('@material/checkbox/dist/mdc.checkbox');
// Use MDCCheckbox, MDCCheckboxFoundation

When no module system is used, every component is added under the global mdc namespace. This occurs regardless of whether or not the entire library or the individual components are used.

Every component also ships with a minified version of its UMD bundle, which can be found at dist/mdc.COMPONENT.min.js.

CSS

All components which include styles provide them at dist/mdc.COMPONENT.css, as well as a complementary minified version at dist/mdc.COMPONENT.min.css. Note that CSS files for a component's dependencies are not included within the component's CSS file, so if you are using individual components you'll have to include each separately.

Each component also comes with a Sass source file that can be included in your application's Sass

// Using the whole library
@import "material-components-web/material-components-web";

// Using individual components / mixins
@import '@material/checkbox';
@import '@material/typography';
@import '@material/elevation/mixins'; // Mixins for elevation.

NOTE: The components' Sass files expect that the node_modules directory containing the @material scope folder is present on the Sass include path.

Running the demos

Setup the repo:

git clone https://github.com/material-components/material-components-web.git && cd material-components-web
npm i

Run the development server (served out of demos/):

cd /path/to/material-components-web
npm run dev
open http://localhost:8080

Useful Links

Browser Support

We officially support the last two versions of every major browser. Specifically, we test on the following browsers:

  • Chrome
  • Safari
  • Firefox
  • IE 11/Edge
  • Opera
  • Mobile Safari
  • Chrome on Android

material-components-web's People

Contributors

addyosmani avatar ajsecord avatar alrra avatar amsheehan avatar anton-kachurin avatar bbosman avatar cristobalchao avatar djalmaaraujo avatar garbee avatar greenkeeper[bot] avatar jasonmayes avatar lynnmercier avatar mco-gh avatar mikemitterer avatar mspl13 avatar nicolasgarnier avatar oddui avatar passy avatar paulkinlan avatar rahul-sagore avatar samccone avatar samthor avatar seanbannister avatar sgomes avatar sindresorhus avatar skaree avatar surma avatar traviskaufman avatar x1ddos avatar yeelan0319 avatar

Watchers

 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.