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
- Getting Started Guide
- Demos (external site)
- Material on other frameworks
- Examples using Material Web
- Contributing
- Material Design Guidelines (external site)
- Supported browsers
- All Components
- Changelog
Quick start
Using via CDN
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/material-components-web.min.css">
<label class="mdc-text-field mdc-text-field--filled">
<span class="mdc-text-field__ripple">span>
<span class="mdc-floating-label" id="my-label">Labelspan>
<input type="text" class="mdc-text-field__input" aria-labelledby="my-label">
<span class="mdc-line-ripple">span>
label>
<script src="https://unpkg.com/[email protected]/dist/material-components-web.min.js">script>
<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 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">Labelspan>
<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('.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.
chore: Release
This PR was opened by release GitHub action. When you're ready to do a release, you can merge this and release action will automatically publishes to npm registry. If you're not ready to do a release yet, that's fine, whenever you add more commits to master, this PR will be updated.
chore: Release
This PR was opened by release GitHub action. When you're ready to do a release, you can merge this and release action will automatically publishes to npm registry. If you're not ready to do a release yet, that's fine, whenever you add more commits to master, this PR will be updated.
chore: Release
This PR was opened by release GitHub action. When you're ready to do a release, you can merge this and release action will automatically publishes to npm registry. If you're not ready to do a release yet, that's fine, whenever you add more commits to master, this PR will be updated.
chore: Release
This PR was opened by release GitHub action. When you're ready to do a release, you can merge this and release action will automatically publishes to npm registry. If you're not ready to do a release yet, that's fine, whenever you add more commits to master, this PR will be updated.
Update webpack to the latest version 🚀
☝️ Greenkeeper’s updated Terms of Service will come into effect on April 6th, 2018.
Version 4.0.0 of webpack was just published.
The version 4.0.0 is not covered by your current version range.
If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.
It might be worth looking into these changes and trying to get this project onto the latest version of webpack.
If you have a solid test suite and good coverage, a passing build is a strong indicator that you can take advantage of these changes directly by merging the proposed change into your project. If the build fails or you don’t have such unconditional trust in your tests, this branch is a great starting point for you to work on the update.
Release Notes
v4.0.0Big changes
mode
or--mode
) between two modes now: production or developmentoptimization.*
(build your custom mode)process.env.NODE_ENV
are set to production or development (only in built code, not in config)none
mode which disables everythingimport()
always returns a namespace object. CommonJS modules are wrapped into the default exportimport()
NoEmitOnErrorsPlugin
->optimization.noEmitOnErrors
(on by default in production mode)ModuleConcatenationPlugin
->optimization.concatenateModules
(on by default in production mode)NamedModulesPlugin
->optimization.namedModules
(on by default in develoment mode)CommonsChunkPlugin
was removed ->optimization.splitChunks
,optimization.runtimeChunk
type: "javascript/auto"
when transforming JSON via loader to JSBig features
javascript/esm
handles ESM more strictly compared tojavascript/auto
:default
import, everything else (including namespace import) emit errors.mjs
modules arejavascript/esm
by defaultimport()
sideEffects: false
is now supported in package.jsonsideEffects
in package.json also supports glob expressions and arrays of glob expressionsoptimization.splitChunks
option was introducedDetails: https://gist.github.com/sokra/1522d586b8e5c0f5072d7565c2bee693
import()
occur in a dead branchwebpackInclude
andwebpackExclude
are supported by the magic comment forimport()
. They allow to filter files when using a dynamic expression.System.import()
now emits a warningRule.parser.system: true
System.import
withRule.parser.system: false
module.rules[].resolve
. It's merged with the global configuration.optimization.minimize
has been added to switch minimizing on/offoptimization.minimizer
has been added to configurate minimizers and optionswebpack-cli
to use the CLI--progress
) now displays plugin namesFeatures
module.rules[].type
options.dependencies
configurations now throw errorsideEffects
can be overriden via module.rulesoutput.hashFunction
can now be a Constructor to a custom hash functionoutput.globalObject
config option to allow to choose the global object reference in runtime exitCodetype
andrequest
.include
test
andexclude
to the eval source map devtool pluginfor of
instead offorEach
Map
andSet
instead of Objectsincludes
instead ofindexOf
text/javascript
andasync
as this are the default values (saves a few bytes)__webpack_require__
and argument is omitted.wasm
,.mjs
,.js
and.json
extensions in this orderoutput.pathinfo
is now on by default in develoment modeentry
defaults to./src
output.path
defaults to./dist
production
defaults when omiting themode
option<{parents}>
>{children}<
and={siblings}=
in StatsbuildAt
time to statsimport()
now emits a error instead of a warningdone
is now an async hookBugfixes
*/
output.chunkCallbackName
to the schema to allow configurating WebWorker templatemodule.id/loaded
now correctly bails out of Module Concatentation (Scope Hoisting)Watching.invalidate
-!
behavior with post loadersrun
andwatchRun
hooks forMultiCompiler
this
is now undefined in ESMvar
,const
orlet
javascript/dynamic
orjavascript/module
is used.buildMeta
of nulloriginal-fs
module for electron targetsplugins
Internal changes
plugin
calls withtap
calls (new plugin system)buildMeta.exportsType: "default"
for json modulesneo-async
instead ofasync
Removed features
module.loaders
loaderContext.options
Compilation.notCacheable
flagNoErrorsPlugin
Dependency.isEqualResource
NewWatchingPlugin
CommonsChunkPlugin
Breaking changes for plugins/loaders
plugin
method is backward-compatibleCompiler.hooks.xxx.tap(<plugin name>, fn)
nowChunk.chunks/parents/blocks
are no longer Arrays. A Set is used internally and there are methods to access it.Parser.scope.renames
andParser.scope.definitions
are no longer Objects/Arrays, but Map/Sets.StackedSetMap
(LevelDB-like datastructure) instead of ArraysCompiler.options
is no longer set while applying pluginsDependency.getReference()
may now return aweak
property.Dependency.weak
is now used by theDependency
base class and returned in the base impl ofgetReference()
Module
sContextModule
andresolveDependencies
Compiler.resolvers
intoCompiler.resolverFactory
accessible with pluginsDependency.isEqualResource
has been replaced withDependency.getResourceIdentifier
Template
are now staticoutputOptions
andrequestShortener
has been moved to this classModule.meta
has been replaced withModule.buildMeta
Module.buildInfo
andModule.factoryMeta
have been addedModule
have been moved into the new objectsloaderContext.rootContext
which points to thecontext
options. Loaders may use it to make stuff relative to the application root.this.hot
flag to loader context when HMR is enabledbuildMeta.harmony
has been replaced withbuildMeta.exportsType: "namespace
map/foreach
Chunks/Modules/Parents
methods are now deprecated/removedcreateGenerator
andgenerator
hooks for NormalModuleFactory to customize code generationCommits
The new version differs by 838 commits.
213226e
4.0.0
fde0183
Merge pull request #6081 from webpack/formating/prettier
b6396e7
update stats
f32bd41
fix linting
5238159
run prettier on existing code
518d1e0
replace js-beautify with prettier
4c25bfb
4.0.0-beta.3
dd93716
Merge pull request #6296 from shellscape/fix/hmr-before-node-stuff
7a07901
Merge pull request #6563 from webpack/performance/assign-depth
c7eb895
Merge pull request #6452 from webpack/update_acorn
9179980
Merge pull request #6551 from nveenjain/fix/templatemd
e52f323
optimize performance of assignDepth
6bf5df5
Fixed template.md
90ab23a
Merge branch 'master' into fix/hmr-before-node-stuff
b0949cb
add integration test for spread operator
There are 250 commits in total.
See the full diff
FAQ and help
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper bot :palm_tree:
chore: Release
This PR was opened by release GitHub action. When you're ready to do a release, you can merge this and release action will automatically publishes to npm registry. If you're not ready to do a release yet, that's fine, whenever you add more commits to master, this PR will be updated.
chore: Update lerna to the latest version 🚀
Version 3.0.0 of lerna was just published.
The version 3.0.0 is not covered by your current version range.
If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.
It might be worth looking into these changes and trying to get this project onto the latest version of lerna.
If you have a solid test suite and good coverage, a passing build is a strong indicator that you can take advantage of these changes directly by merging the proposed change into your project. If the build fails or you don’t have such unconditional trust in your tests, this branch is a great starting point for you to work on the update.
Release Notes
v3.0.0Bug Fixes
file:
specifiers (ffe354f)file:
specifiers (41f231f)npm pack
experience (627cfc2)Features
@lerna/listable
utility (bf56018)npm pack
beforenpm publish
(8d80b2c)@lerna/log-packed
module, extracted from npm (9c767ac)lerna version
from oflerna publish
(#1522) (8b97394),closes #277 #936 #956 #961 #1056 #1118 #1385 #1483 #1494
BREAKING CHANGES
lerna changed
lerna ls
lerna ls
no longer shows version strings or private packages.lerna la
resembles the old output, with the addition of relative path to the packagelerna ll
is a shortcut for the new--long
option--parseable
option has been added to aid magical piping incantationslerna publish
--preid
now defaults to "alpha" during prereleases:The previous default for this option was undefined, which led to an awkward "1.0.1-0" result when passed to
semver.inc()
.The new default "alpha" yields a much more useful "1.0.1-alpha.0" result. Any previous prerelease ID will be preserved, justas it was before.
--no-verify
is no longer passed togit commit
by default, but controlled by the new--commit-hooks
option:The previous behavior was too overzealous, and the new option operates exactly like the corresponding npm version option of the same name.
As long as your pre-commit hooks are properly scoped to ignore changes in package.json files, this change should not affect you. If that is not the case, you may pass
--no-commit-hooks
to restore the previous behavior.FAQ and help
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper bot :palm_tree:
refactor(slider): Functional slider tick visuals with css background
So one of the few components you make it difficult to test for is the slider, but AFAIKT, this completely resolves #4729. Outside of the suite, I deployed and performed a pretty rigid stress test and it behaviorally matches up. Maybe the remove method could be taken out, since the new append method essentially just replaces values, but I left an updated definition of it just in case it *could be called from elsewhere to hide ticks, between altering tick marker numbers, etc...
cc @moog16 please comb this, even aside from my assurance of it behaving implacably in browser. Meaning, rename "append" to "create" and fix my typo on line 140 of the adapter if you want. :)
feat(expansion-panel): Add Expansion Panel component
closes #46
This is ready for code review.
Engineering Outline
TODO:
toggleExpansion()
when target is not appropriateI need guidance on a few things:
expand_more
in the foundation because the spec shows that exact icon. Is this preferable to actually inserting the icon into the header manually and not having the user create the icon at all?Update lerna to the latest version 🚀
Version 2.0.0-rc.1 of lerna just got published.
The version 2.0.0-rc.1 is not covered by your current version range.
Without accepting this pull request your project will work just like it did before. There might be a bunch of new features, fixes and perf improvements that the maintainers worked on for you though.
I recommend you look into these changes and try to get onto the latest version of lerna. Given that you have a decent test suite, a passing build is a strong indicator that you can take advantage of these changes by merging the proposed change into your project. Otherwise this branch is a great starting point for you to work on the update.
Release Notes
v2.0.0-rc.1v2.0.0-rc.1 (2017-04-07)
A silent (but deadly) bug slipped into the last release. Many thanks to (@timdp) for discovering it.
Commits
The new version differs by 94 commits .
d12c4da
2.0.0-rc.1
c1e7910
Update changelog for v2.0.0-rc.1
ad7e214
Fix package.json updates during publish (#744)
634d16d
fix: use relative path for file: dependency
f81a940
2.0.0-rc.0
7319e56
v2.0.0-rc.0 changelog (#739)
25e9b9c
Use babel-preset-env (#738)
c2fbcb2
Update eslint, config, and plugins (#737)
c9ed57a
Command: pass explicit CWD to Repository constructor (#734)
0cd40ec
Commands: pass execOpts to all utility executions to avoid implicit process.cwd() (#733)
114a07a
Update FAQ.md (#736)
048d0cb
test(all): Refactor into Jest idioms, adding integration tests (#714)
6de5cc5
fix(PackageUtilities): remove public API, it's broken anyway (#732)
e4b9454
fix(BootstrapCommand): symlink binaries of scoped packages correctly (#731)
2be31cd
Upgrade progress (#729)
There are 94 commits in total. See the full diff.
Not sure how things should work exactly?
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot :palm_tree:
Update webpack-dev-server to the latest version 🚀
☝️ Greenkeeper’s updated Terms of Service will come into effect on April 6th, 2018.
Version 3.0.0 of webpack-dev-server was just published.
The version 3.0.0 is not covered by your current version range.
If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.
It might be worth looking into these changes and trying to get this project onto the latest version of webpack-dev-server.
If you have a solid test suite and good coverage, a passing build is a strong indicator that you can take advantage of these changes directly by merging the proposed change into your project. If the build fails or you don’t have such unconditional trust in your tests, this branch is a great starting point for you to work on the update.
Release Notes
v3.0.0Updates
Bugfixes
Huge thanks to all the contributors!
Please note that webpack-serve will eventually be the successor of webpack-dev-server. The core features already work so if you're brave enough give it a try!
Commits
The new version differs by 20 commits.
6e1d886
3.0.0
eedf10f
Try again at fixing CI by upping timeout (necessary for node v6)
dfe137c
Hopefully fix failing CI tests (the hacky way)
1e7acca
Actually make the yargs version test do something
cdd10fa
Stop testing node v4 on travis ci
7378e3e
Merge branch 'webpack-4'
ab4eeb0
Fix page not reloading after fixing first error on page (#1317)
dbea323
Update deps
f4f14ce
Fix support for DynamicEntryPlugin (#1319)
398c773
3.0.0-beta.2
cdc7288
Simplify build webpack configs thanks to webpack 4
e603e0d
Allow no publicPath or entry point (#1310)
9852a5f
3.0.0-beta.1
6db2e85
Fix tests after webpack v4 upgrade
eb2f0a9
Fix option rename in webpack-dev-middleware
There are 20 commits in total.
See the full diff
FAQ and help
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper bot :palm_tree:
[MDCList MDCDialog] FocusTrap throws an error
Bug report
I am trying to get a simple dialog to work with a preselected item. it works propperly but still throws an error. It looks like a bug but i might be doing something wrong.
Steps to reproduce
Actual behavior
thows error:
material-components-web.min.js:1 Uncaught Error: FocusTrap: Element must have at least one focusable child. at r.trapFocus (material-components-web.min.js:1:26219) at Object.trapFocus (material-components-web.min.js:1:376068) at material-components-web.min.js:1:169218
Expected behavior
no error
Your Environment:
| Software | Version(s) | | ---------------- | ---------- | | MDC Web | 14 | Browser | brave (chromium) | Operating System | windows 10
Additional context
The console in codepen does not show the error, only the console of crome. it only happens the first time. when you select an item and open the dialog again it works as expected.
[MDCDialog] Focus is set to an element outside the dialog when the dialog is open
Bug report
When scrimClickAction is set to '', clicking on the scrim then pressing tab sets focus to an element outside the dialog.
Steps to reproduce
https://codepen.io/mdooley1/pen/RwJXqqL
Actual behavior
Focus is set to a focusable element outside the dialog.
Expected behavior
Focus remains on elements within the dialog.
Your Environment:
| Software | Version(s) | | ---------------- | ---------- | | MDC Web | v14 | Browser | Version 108.0.5359.9 | Operating System | macOS 12.6.1
chore(deps): bump qs from 6.5.2 to 6.5.3
Bumps qs from 6.5.2 to 6.5.3.
Changelog
Sourced from qs's changelog.
Commits
298bfa5
v6.5.3ed0f5dc
[Fix]parse
: ignore__proto__
keys (#428)691e739
[Robustness]stringify
: avoid relying on a globalundefined
(#427)1072d57
[readme] remove travis badge; add github actions/codecov badges; update URLs12ac1c4
[meta] fix README.md (#399)0338716
[actions] backport actions from main5639c20
Clean up license text so it’s properly detected as BSD-3-Clause51b8a0b
add FUNDING.yml45f6759
[Fix] fix for an impossible situation: when the formatter is called with a no...f814a7f
[Dev Deps] backport from mainDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.
chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2
Bumps decode-uri-component from 0.2.0 to 0.2.2.
Release notes
Sourced from decode-uri-component's releases.
Commits
a0eea46
0.2.2980e0bf
Prevent overwriting previously decoded tokens3c8a373
0.2.176abc93
Switch to GitHub workflows746ca5d
Fix issue where decode throws - fixes #6486d7e2
Update license (#1)a650457
Tidelift tasks66e1c28
Meta tweaksDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.