diff --git a/demos/snackbar.html b/demos/snackbar.html index c87fd24768e..dad32a74974 100644 --- a/demos/snackbar.html +++ b/demos/snackbar.html @@ -124,14 +124,14 @@

Basic Example

- +

- +

diff --git a/demos/text-field.html b/demos/text-field.html index 429081f58e7..476f057047d 100644 --- a/demos/text-field.html +++ b/demos/text-field.html @@ -64,7 +64,7 @@
- +
@@ -74,7 +74,7 @@

Full Functionality JS Component (Floating Label, Validation)

- +

Password field with validation - +

Outlined Text Field

- +
@@ -175,7 +175,7 @@

Text Field box

- +

Text Field - Leading/Trailing icons class="mdc-text-field mdc-text-field--box mdc-text-field--with-leading-icon" data-demo-no-auto-js> event - +

@@ -228,7 +228,7 @@

Text Field - Leading/Trailing icons

- + delete
@@ -238,7 +238,7 @@

Text Field - Leading/Trailing icons

class="mdc-text-field mdc-text-field--outlined mdc-text-field--with-leading-icon" data-demo-no-auto-js> event - +
@@ -251,7 +251,7 @@

Text Field - Leading/Trailing icons

- + delete
@@ -291,7 +291,7 @@

Text Field - Leading/Trailing icons

Preventing FOUC

-
diff --git a/demos/theme/index.html b/demos/theme/index.html index 94a3a2d7af3..d32136b5384 100644 --- a/demos/theme/index.html +++ b/demos/theme/index.html @@ -836,7 +836,7 @@

id="demo-text-field-default" aria-controls="demo-text-field-default-helper-text" autocomplete="email"> - +

aria-controls="demo-text-field-required-helper-text" autocomplete="email" required> - +

@@ -863,7 +863,7 @@

- +

@@ -56,14 +56,14 @@ Get up and running with Material Components for web

Hello, Material Components!

- +
``` 4. {: .step-list-item } ### Add scripts and instantiate - Add the MDC Web scripts and call MDC Auto Init. + Add the MDC Web scripts and call MDC Auto Init. ```html @@ -71,7 +71,7 @@ Get up and running with Material Components for web ``` A full example of the HTML could look like this: - + ```html @@ -84,7 +84,7 @@ Get up and running with Material Components for web

Hello, Material Components!

- +
diff --git a/docs/getting-started.md b/docs/getting-started.md index 1752bfb4814..2c58e67f041 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -67,7 +67,7 @@ module.exports = [{ output: { // This is necessary for webpack to compile // But we never use style-bundle.js - filename: 'style-bundle.js', + filename: 'style-bundle.js', }, module: { rules: [{ diff --git a/docs/migrating-from-mdl.md b/docs/migrating-from-mdl.md index 1f5f6d4a62a..af4c3fc3930 100644 --- a/docs/migrating-from-mdl.md +++ b/docs/migrating-from-mdl.md @@ -92,7 +92,7 @@ MDC Web: ```html
- +
``` @@ -118,7 +118,7 @@ element, with the component’s class name as the value. For example: ```html
- +
``` @@ -199,7 +199,7 @@ Like in MDL, styling components with CSS classes is simply a matter of applied t ```html
- +
``` diff --git a/package.json b/package.json index 073cf0c8713..39194f81308 100644 --- a/package.json +++ b/package.json @@ -130,6 +130,7 @@ "drawer", "elevation", "fab", + "floating-label", "form-field", "grid-list", "icon-toggle", @@ -168,6 +169,7 @@ "mdc-base", "mdc-checkbox", "mdc-chips", + "mdc-floating-label", "mdc-form-field", "mdc-icon-toggle", "mdc-line-ripple", diff --git a/packages/material-components-web/index.js b/packages/material-components-web/index.js index f6c42e70e47..a35f22f5a7c 100644 --- a/packages/material-components-web/index.js +++ b/packages/material-components-web/index.js @@ -20,6 +20,7 @@ import * as checkbox from '@material/checkbox/index'; import * as chips from '@material/chips/index'; import * as dialog from '@material/dialog/index'; import * as drawer from '@material/drawer/index'; +import * as floatingLabel from '@material/floating-label/index'; import * as formField from '@material/form-field/index'; import * as gridList from '@material/grid-list/index'; import * as iconToggle from '@material/icon-toggle/index'; @@ -44,6 +45,7 @@ autoInit.register('MDCChipSet', chips.MDCChipSet); autoInit.register('MDCDialog', dialog.MDCDialog); autoInit.register('MDCPersistentDrawer', drawer.MDCPersistentDrawer); autoInit.register('MDCTemporaryDrawer', drawer.MDCTemporaryDrawer); +autoInit.register('MDCFloatingLabel', floatingLabel.MDCFloatingLabel); autoInit.register('MDCFormField', formField.MDCFormField); autoInit.register('MDCRipple', ripple.MDCRipple); autoInit.register('MDCGridList', gridList.MDCGridList); @@ -69,6 +71,7 @@ export { chips, dialog, drawer, + floatingLabel, formField, gridList, iconToggle, diff --git a/packages/material-components-web/material-components-web.scss b/packages/material-components-web/material-components-web.scss index f8476666470..65f2a08f5da 100644 --- a/packages/material-components-web/material-components-web.scss +++ b/packages/material-components-web/material-components-web.scss @@ -22,6 +22,7 @@ @import "@material/drawer/mdc-drawer"; @import "@material/elevation/mdc-elevation"; @import "@material/fab/mdc-fab"; +@import "@material/floating-label/mdc-floating-label"; @import "@material/form-field/mdc-form-field"; @import "@material/grid-list/mdc-grid-list"; @import "@material/icon-toggle/mdc-icon-toggle"; diff --git a/packages/material-components-web/package.json b/packages/material-components-web/package.json index 96299c2e872..51754244696 100644 --- a/packages/material-components-web/package.json +++ b/packages/material-components-web/package.json @@ -24,6 +24,7 @@ "@material/drawer": "^0.30.0", "@material/elevation": "^0.28.0", "@material/fab": "^0.31.0", + "@material/floating-label": "0.0.0", "@material/form-field": "^0.31.0", "@material/grid-list": "^0.30.0", "@material/icon-toggle": "^0.31.0", diff --git a/packages/mdc-auto-init/README.md b/packages/mdc-auto-init/README.md index af64a85296c..98e911c1346 100644 --- a/packages/mdc-auto-init/README.md +++ b/packages/mdc-auto-init/README.md @@ -32,7 +32,7 @@ writing the markup, simply insert a script tag that calls `mdc.autoInit()`. Make ```html
- +
@@ -52,7 +52,7 @@ using a property whose name is the value of `data-mdc-auto-init`. For example, g ```html
- +
``` diff --git a/packages/mdc-floating-label/README.md b/packages/mdc-floating-label/README.md new file mode 100644 index 00000000000..8626044ac2d --- /dev/null +++ b/packages/mdc-floating-label/README.md @@ -0,0 +1,94 @@ + + +# Floating Label + +Floating labels display the type of input a field requires. Every text field and select should have a label. Labels are aligned with the input line and always visible. They can be resting (when a field is inactive and empty) or floating. The label is a text caption or description for the text field. + +## Design & API Documentation + + + +## Usage + +### HTML Structure + +```html + +``` + +### Usage within `mdc-text-field` + +```html +
+ + +
+
+``` + + + +#### Avoid Dynamic ID Generation + +If you're using the JavaScript-enabled version of floating label, you can avoid needing to assign +a unique `id` to each `` by wrapping `mdc-text-field__input` within a `