• Stars
    star
    17,138
  • Rank 1,604 (Top 0.04 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 8 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Modular and customizable Material Design UI components for the web

Version Chat

Material Components for the web

Material Components for the web helps 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 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.

Material Components for the web is the successor to Material Design Lite. In addition to implementing the Material Design guidelines, it provides more flexible theming customization, not only in terms of color, but also typography, shape, states, and more. It is also specifically architected for adaptability to various major web frameworks.

NOTE: Material Components Web tends to release breaking changes on a monthly basis, but follows semver so you can control when you incorporate them. We typically follow a 2-week release schedule which includes one major release per month with breaking changes, and intermediate patch releases with bug fixes.

Important links

Quick start

Using via CDN

<!-- Required styles for Material Web -->
<link rel="stylesheet" href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css">

<!-- Render textfield component -->
<label class="mdc-text-field mdc-text-field--filled">
  <span class="mdc-text-field__ripple"></span>
  <span class="mdc-floating-label" id="my-label">Label</span>
  <input type="text" class="mdc-text-field__input" aria-labelledby="my-label">
  <span class="mdc-line-ripple"></span>
</label>

<!-- Required Material Web JavaScript library -->
<script src="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js"></script>
<!-- Instantiate single textfield component rendered in the document -->
<script>
  mdc.textField.MDCTextField.attachTo(document.querySelector<HTMLElement>('.mdc-text-field'));
</script>

Please see quick start demo on codepen for full example.

Using NPM

This guide assumes you have webpack configured to compile Sass into CSS. To configure webpack, please see the full getting started guide. You can also see the final code and result in the Material Starter Kit.

Install textfield node module to your project.

npm install @material/textfield

HTML

Sample usage of text field component. Please see Textfield component page for more options.

<label class="mdc-text-field mdc-text-field--filled">
  <span class="mdc-text-field__ripple"></span>
  <input type="text" class="mdc-text-field__input" aria-labelledby="my-label">
  <span class="mdc-floating-label" id="my-label">Label</span>
  <span class="mdc-line-ripple"></span>
</label>

CSS

Load styles required for text field component.

@use "@material/floating-label/mdc-floating-label";
@use "@material/line-ripple/mdc-line-ripple";
@use "@material/notched-outline/mdc-notched-outline";
@use "@material/textfield";

@include textfield.core-styles;

JavaScript

Import MDCTextField module to instantiate text field component.

import {MDCTextField} from '@material/textfield';
const textField = new MDCTextField(document.querySelector<HTMLElement>('.mdc-text-field'));

This'll initialize text field component on a single .mdc-text-field element.

Please see quick start demo on glitch for full example.

Need help?

We're constantly trying to improve our components. If Github Issues don't fit your needs, then please visit us on our Discord Channel.

More Repositories

1

material-components-android

Modular and customizable Material Design UI components for Android
Java
16,311
star
2

material-web

Material Design Web Components
TypeScript
9,320
star
3

material-components-ios

[In maintenance mode] Modular and customizable Material Design UI components for iOS
Objective-C
4,725
star
4

material-components-android-examples

Companion example apps and code for MDC-Android.
Kotlin
2,486
star
5

material-components-web-react

Material Components for React (MDC React)
TypeScript
2,018
star
6

material-components

Documentation and policies for Material Components (all platforms)
1,072
star
7

material-components-flutter

Modular and customizable Material Design UI components for Flutter
Dart
894
star
8

material-components-android-compose-theme-adapter

A library that enables reuse of Material themes defined in XML for theming in Jetpack Compose.
Kotlin
408
star
9

material-components-android-codelabs

Codelabs for Material Components for Android (MDC-Android)
Java
219
star
10

material-components-flutter-codelabs

Codelabs for Material Components for Flutter
Dart
212
star
11

material-components-android-motion-codelab

Kotlin
173
star
12

material-components-flutter-experimental

Work in progress code, implementation options, and design prototypes
Dart
130
star
13

material-components-web-codelabs

Codelabs for Material Components for Web (MDC Web)
HTML
128
star
14

material-components-web-catalog

Catalog of Material Components for the web (MDC Web)
JavaScript
116
star
15

material-components-site-generator

Generator of Material Components documentation sites.
JavaScript
79
star
16

material-design-for-wordpress

Material Design plugin for WordPress
JavaScript
78
star
17

material-components-flutter-motion-codelab

Codelab for Material motion for Flutter
Dart
60
star
18

material-components-ios-codelabs

Codelabs for Material Components for iOS (MDC-iOS)
Objective-C
38
star
19

material-components-flutter-gallery

Dart
22
star
20

material-components-flutter-codelabs-packages

Assets for Material Flutter codelabs
21
star
21

material-components-design-codelabs

Material Design codelabs for designers
16
star
22

material-components-ios-codelabs-2017

Codelabs for Material Components for iOS (MDC-iOS) 2017
Objective-C
15
star
23

material-components-ios-skeleton-objc

A template and sample code that you can use to start a new Material Components for iOS (MDC-iOS) application.
5
star
24

material-components-motion-experimental

Experimental work around motion
5
star
25

.github

3
star
26

.allstar

1
star