{"bugs":{"url":"https://github.com/material-components/material-components-web/issues"},"dist":{"shasum":"745e48a2a021b526088738c69ca7f8dc16a09d13","tarball":"https://registry.npmjs.org/@material/form-field/-/form-field-9.0.0-canary.30fdfd06e.0.tgz","fileCount":34,"integrity":"sha512-vxqT0uTSaCSyrxCeq/iY3RmSVjctQogffhv9kYxc0O5QVZzAo5F3+RqlhR5yceLniDuV+gecqXWV2rR6mr1cCw==","signatures":[{"sig":"MEUCIQCsgYjgYJpm7sqZ6Rq/5ikD3aZfwvaR3mGCqqymdP2tzQIgUe8RctFhGgfvRUmuSKLgqTz2XKZoHyFHuTpZDRHZbDA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":179565,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf2lr9CRA9TVsSAnZWagAARrAP/3NGgluLBcC4XdBfPkte\nxPQSH6v6pd+1Pml0Cw8CJugoHyqnpHT49xBPHpHNuOw93ZRGJl/j6kzVUaQr\nhj/DnI/O48sM70VA8e9b/BZ0WrN5Kv+qWfI7+mtTPoHUMJ42RtZ0zbdGS6YZ\n240SslCZpmCdsZZjjhppKEpjb2MmmMzV4oYxwbJ1f+E1UzDQagHrsyozvsmk\nKwp/Gagtx87QT/aOOMtTz9zTaWSa9+MR5gXufz7uuZMsssbH+cGG+Qmm4msm\nTvW6ydje38SZU3k3fEKhn2ypQl27DFI49Q6iVlSu9AwWD9LegT9fsEEa/FwK\nXbhgA1LfzEs/tiQcUBOZydJOFIUjBFcGZ0i+50G4rYfsQE3oejwev1oLj7rl\nLM2tS1D5WOH5cHqVfbjQPv7rZV8UIbAmNaM9KRYG8UrOfauoMDsw4UEslF1y\nMJavbqufznJwPYAn80uXxZLPuug63McI+ccBdr21GZfoX0za/Pn5M2KFTdqX\nm3gt9LRuoUp33TrCN/pl61aQcNWUb5k7gWxIij2X4dNIj5KdxbGcX9cCGsWP\nPbN5TFoNuB9dW9e9ytzl8dWgRd50uMvi2mzkjsPXqsXPS3i+HyqozOnB4IsJ\nzTQXH30KcJliKTc0lkjVcgTJSi7euYI0yQkvSphwOpPyW8rlWnDWca2quQHB\nnTRR\r\n=tQ5Z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/mdc.formField.js","name":"@material/form-field","types":"dist/mdc.formField.d.ts","module":"index.js","readme":"<!--docs:\ntitle: \"Form Fields\"\nlayout: detail\nsection: components\npath: /catalog/input-controls/form-fields/\n-->\n\n# Form Fields\n\nMDC Form Field aligns an MDC Web form field (for example, a checkbox) with its label and makes it RTL-aware. It also activates a [ripple](../mdc-ripple) effect upon interacting with the label.\n\n## Installation\n\n```\nnpm install @material/form-field\n```\n\n## Demos\n\n<ul class=\"icon-list\">\n  <li class=\"icon-list-item icon-list-item--link\">\n    <a href=\"https://material-components.github.io/material-components-web-catalog/#/component/radio\">Demo with radio button</a>\n  </li>\n</ul>\n\n## Basic Usage\n\n### HTML Structure\n\nUse the `mdc-form-field` element to wrap any combination of adjacent _input_ and _label_ elements of MDC Web form controls, such as [MDC Checkbox](../mdc-checkbox) or [MDC Radio](../mdc-radio). Here's an example with MDC Checkbox:\n\n```html\n<div class=\"mdc-form-field\">\n  <div class=\"mdc-checkbox\">\n    <input type=\"checkbox\" id=\"my-checkbox\" class=\"mdc-checkbox__native-control\"/>\n    <div class=\"mdc-checkbox__background\">\n      ...\n    </div>\n  </div>\n  <label for=\"my-checkbox\">This is my checkbox</label>\n</div>\n```\n\n> _NOTE_: MDC Form Field is **not** intended for cases where a label and input are already handled together in a component's styles and logic. For example, [MDC Text Field](../mdc-textfield) already manages a label and input together under its own root element.\n\n### JavaScript Instantiation\n\nIf you are using MDC Form Field with an MDC Web component that has a [ripple](../mdc-ripple) effect, you can instantiate `MDCFormField` and set its [`input` property](#mdcformfield-properties-and-methods) to activate the ripple effect upon interacting with the label. Here is an example with [MDC Checkbox](../mdc-checkbox):\n\n```js\nimport {MDCFormField} from '@material/form-field';\nimport {MDCCheckbox} from '@material/checkbox';\n\nconst formField = new MDCFormField(document.querySelector('.mdc-form-field'));\nconst checkbox = new MDCCheckbox(document.querySelector('.mdc-checkbox'));\nformField.input = checkbox;\n```\n\n> See [Importing the JS component](../../docs/importing-js.md) for more information on how to import JavaScript.\n\n## Variants\n\n### Label position\n\nBy default, the input will be positioned before the label. You can position the input after the label by adding the `mdc-form-field--align-end` class:\n\n```html\n<div class=\"mdc-form-field mdc-form-field--align-end\">\n  <div class=\"mdc-checkbox\">\n    <input type=\"checkbox\" id=\"my-checkbox\" class=\"mdc-checkbox__native-control\"/>\n    <div class=\"mdc-checkbox__background\">\n      ...\n    </div>\n  </div>\n  <label for=\"my-checkbox\">This is my checkbox</label>\n</div>\n```\n\n### Nowrap\n\nIf the label text is too long for a single line, it will wrap the text by default. You can force the text to stay on a single line and ellipse the overflow text by adding the `mdc-form-field--nowrap` class:\n\n```html\n<div class=\"mdc-form-field mdc-form-field--nowrap\">\n  <div class=\"mdc-checkbox\">\n    <input type=\"checkbox\" id=\"my-checkbox\" class=\"mdc-checkbox__native-control\"/>\n    <div class=\"mdc-checkbox__background\">\n      ...\n    </div>\n  </div>\n  <label for=\"my-checkbox\">This some really really really long text</label>\n</div>\n```\n\n## `MDCFormField` Properties and Methods\n\nProperty | Value Type | Description\n--- | --- | ---\n`input` | String | Gets and sets the form field input. \n\nIn order for the label ripple integration to work correctly, the `input` property needs to be set to a valid instance of an MDC Web input element which exposes a `ripple` getter. No action is taken if the `input` property is not set or the input instance doesn't expose a `ripple` getter.\n\n## Usage within Web Frameworks\n\nIf you are using a JavaScript framework, such as React or Angular, you can create a Form Field for your framework. Depending on your needs, you can use the _Simple Approach: Wrapping MDC Web Vanilla Components_, or the _Advanced Approach: Using Foundations and Adapters_. Please follow the instructions [here](../../docs/integrating-into-frameworks.md).\n\n### `MDCFormFieldAdapter`\n\n| Method Signature | Description |\n| --- | --- |\n| `registerInteractionHandler(type: string, handler: EventListener) => void` | Adds an event listener `handler` for event type `type` to the label. |\n| `deregisterInteractionHandler(type: string, handler: EventListener) => void` | Removes an event listener `handler` for event type `type` to the label. |\n| `activateInputRipple() => void` | Activates the ripple on the input element. Should call `activate` on the input element's `ripple` property. |\n| `deactivateInputRipple() => void` | Deactivates the ripple on the input element. Should call `deactivate` on the input element's `ripple` property. |\n","gitHead":"f9c9fe091a06230b038ac8a71ccd652c7c662b96","license":"MIT","_npmUser":{"name":"abhiomkar","email":"abhiomkar@gmail.com"},"homepage":"https://github.com/material-components/material-components-web#readme","keywords":["material components","material design","form"],"repository":{"url":"git+https://github.com/material-components/material-components-web.git","type":"git","directory":"packages/mdc-form-field"},"_npmVersion":"lerna/3.20.2/node@v10.23.0+x64 (linux)","description":"Material Components for the web wrapper for laying out form fields and labels next to one another","directories":{},"maintainers":[{"name":"material-admin","email":"aprigogin+npm@google.com"},{"name":"abhiomkar","email":"abhiomkar@gmail.com"},{"name":"azakus","email":"dfreedm2@gmail.com"},{"name":"bicknellr","email":"bicknellr@gmail.com"},{"name":"bwobrien","email":"obrien.test@gmail.com"},{"name":"lynnjepsen","email":"lynnjepsen@google.com"},{"name":"acdvorak","email":"acdvorak@gmail.com"},{"name":"kfranqueiro","email":"kenneth.franqueiro@gmail.com"},{"name":"aprigogin","email":"andrey.prigogin@gmail.com"},{"name":"patrickrodee","email":"prodee@google.com"},{"name":"bonniez","email":"bonniez@google.com"},{"name":"moog16","email":"mattgoo@gmail.com"},{"name":"williamernest","email":"williamernest@google.com"},{"name":"aomarks","email":"aomarks@gmail.com"},{"name":"emarquez","email":"emarquez@google.com"},{"name":"allanchen","email":"allanchen@google.com"},{"name":"esgonzalez","email":"esgonzalez@google.com"},{"name":"asyncliz","email":"asyncliz@gmail.com"},{"name":"candysonya","email":"wangchan518@gmail.com"},{"name":"ssuarez","email":"sayrisuarez@google.com"},{"name":"taylorv","email":"brian.t.vann@gmail.com"}],"sideEffects":false,"_nodeVersion":"10.23.0","dependencies":{"tslib":"^1.9.3","@material/rtl":"9.0.0-canary.30fdfd06e.0","@material/base":"9.0.0-canary.30fdfd06e.0","@material/theme":"9.0.0-canary.30fdfd06e.0","@material/ripple":"9.0.0-canary.30fdfd06e.0","@material/typography":"9.0.0-canary.30fdfd06e.0","@material/feature-targeting":"9.0.0-canary.30fdfd06e.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/form-field_9.0.0-canary.30fdfd06e.0_1608145661465_0.7582987940404822","host":"s3://npm-registry-packages"},"_id":"@material/form-field@9.0.0-canary.30fdfd06e.0","version":"9.0.0-canary.30fdfd06e.0"}