Skip to content
Modular and customizable Material Design UI components for the web
TypeScript CSS JavaScript Shell
Branch: master
Clone or download

Latest commit

Copybara-Service
Copybara-Service Merge pull request #5863 from mroskamp:patch-1
PiperOrigin-RevId: 311571236
Latest commit 8d96d81 May 14, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github chore: Use actions/create-release Action to create release (#5862) Apr 27, 2020
docs feat(textfield): add filled class variant Apr 17, 2020
packages Merge pull request #5863 from mroskamp:patch-1 May 14, 2020
scripts chore: Add circular progress to dependency test (#5707) Mar 11, 2020
testing test(infra): Fix compilation errors from TS3.8 upgrade. Feb 13, 2020
.editorconfig chore: Add .editorconfig file (#4488) Mar 12, 2019
.eslintignore chore(infrastructure): automate method description table in README.md ( Jul 23, 2019
.eslintrc.yaml feat: Convert packages to TypeScript (#4451) Feb 27, 2019
.gitattributes chore: remove demos and update documentation appropriately (#4752) Jun 3, 2019
.gitignore chore: remove unneeded package-lock.json (#5697) Mar 10, 2020
.mdc-docsite.yml docs: Prep component READMEs for documentation site. (#511) May 9, 2017
.nvmrc chore: Add nvmrc (#5534) Jan 29, 2020
.stylelintignore chore(infrastructure): Add stylelint config for screenshot tests (#2144) Sep 4, 2018
.stylelintrc.yaml chore: Stylelint rules to keep it in sync with internal (#5445) Jan 10, 2020
CHANGELOG.md Clean changelog. Apr 23, 2020
CONTRIBUTING.md test(infra): Remove screenshot testing commands and docs. (#5594) Feb 10, 2020
LICENSE chore: update copyright year Mar 16, 2020
README.md docs: Small README updates for clarity (#5874) Apr 30, 2020
ROADMAP.md docs: Update removing System ROADMAP.md link (#4795) Jun 10, 2019
app.yaml chore: Remove reference to appspot demo server. (#3681) Oct 1, 2018
jasmine-node.json test(feature-targeting): Move common feature targeting test cod… (#5485) Jan 17, 2020
karma.conf.js test(infra): Remove code coverage config now that we've set up… (#5576) Feb 7, 2020
lerna.json chore: Release Apr 23, 2020
package-lock.json build(deps): bump jquery from 3.4.1 to 3.5.0 (#5872) Apr 30, 2020
package.json chore: possible fix for package-lock issue on npm i (#5771) Apr 2, 2020
tsconfig-base.json fix(core): Fix canary release by excluding test files from default ts… Dec 9, 2019
tsconfig-node.json test(feature-targeting): Move common feature targeting test cod… (#5485) Jan 17, 2020
tsconfig.json fix(core): Fix canary release by excluding test files from default ts… Dec 9, 2019
tslint.json chore: Match TSLint rules with Google TS style guide (#5369) Dec 20, 2019
webpack.config.js feat: update to MIT license (#3376) Aug 21, 2018

README.md

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">
  <input type="text" class="mdc-text-field__input" aria-labelledby="my-label">
  <span class="mdc-floating-label" id="my-label">Label</span>
  <div class="mdc-line-ripple"></div>
</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('.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">
  <input type="text" class="mdc-text-field__input" aria-labelledby="my-label">
  <span class="mdc-floating-label" id="my-label">Label</span>
  <div class="mdc-line-ripple"></div>
</label>

CSS

Load styles required for text field component.

@import "@material/textfield/mdc-text-field";

JavaScript

Import MDCTextField module to instantiate text field component.

import {MDCTextField} from '@material/textfield/index';
const textField = new MDCTextField(document.querySelector('.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.

You can’t perform that action at this time.