开源软件名称(OpenSource Name):material-components/material-components-web开源软件地址(OpenSource Url):https://github.com/material-components/material-components-web开源编程语言(OpenSource Language):TypeScript 64.7%开源软件介绍(OpenSource Introduction):Material Components for the webMaterial 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.
Important links
Quick startUsing 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('.mdc-text-field'));
</script>
Using NPM
Install textfield node module to your project.
HTMLSample 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> CSSLoad 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;
JavaScriptImport import {MDCTextField} from '@material/textfield';
const textField = new MDCTextField(document.querySelector('.mdc-text-field')); This'll initialize text field component on a single
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. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论