{"bugs":{"url":"https://github.com/material-components/material-components-web/issues"},"dist":{"shasum":"8d92dc2bc069c206bcd9a13ab478f55e0daa9227","tarball":"https://registry.npmjs.org/@material/button/-/button-14.0.0-canary.bbd11268f.0.tgz","fileCount":40,"integrity":"sha512-K643m87hUV6uLdZ3lvGp1QRYmnyTXnhdcq7er5WC5ocnt2DUAb3OG1VyDHZ9lzenGqtJR0+CVlMQJ/KnC7l/Jg==","signatures":[{"sig":"MEUCIBHR0/SWl93Zu07mXoF4cfw6eKV//QQ2rPK2llim6IpKAiEAkuAqjHvAIFC5IdKO/AWLLHiTvRPb7VamB1t1KOTPX/s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":638235,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhnWwnCRA9TVsSAnZWagAA308P/3x9EgMkFzylIKgdND5n\n3sJfq7FjSfhkIg8tMZqyPImC0rrSqQiAaUjYrOsKtsUztWp7iZQGMmokOE7S\nWOum0OKc/ZjVtjsSx7AQI4CG/KKD4WKsJIraI/lB/gfNq3PVs3LG1noTFYuH\nL48BXL7Nl8rXr6NmcmfhWMdEVO/51/5hUy4ZJBE8zwhlVxat+v2Tv3IQyyGw\nGpjPYVR+kxiYeCctXtfAHxnm9hD998j/WJQhez8hzwIFqXPetOi0xP9NdtD4\nLCN/gZAgzIBsE8tvyJCXXY8re1GcbE5AuT1vJDJazRLa1HqyoUqzGkmbhc4Y\n9ktPyGSNLM2uOK5pzijFrgOo8WMfW0zC1A/WZm+OpkDfWBPYh90adcFGKGVd\nZ/2F0efkojPJSgxdqdZ/GxUqXsP1XPE1sB6DG630+M+cp0iv96g9b0fhQOBh\nBzVA3JJAx/QhqtPOFDIrnqvPvB97R0ADl4qm+2QJ7XfEN4ch9PeQ5fZ5dlxf\n9fCOlmc5aypxDC9Lhtmw/fFasI8ucufd+g12DXXkutPpUXw9i+1GLqFT6tl5\nLHKwhz6DzNH28OcV/tCv1nvIZ+NF1V/2hlnQeLg97FflRQgqZvC0Jm0CK1iJ\nbkJEBdPMljwSSrlBPeJhoqPqgNa2KUfKUHIc0wGPds3djJEyB+OLDBnVZFb2\nIGcl\r\n=u5GI\r\n-----END PGP SIGNATURE-----\r\n"},"name":"@material/button","readme":"<!--docs:\ntitle: \"Buttons\"\nlayout: detail\nsection: components\nexcerpt: \"Web Buttons\"\niconId: button\npath: /catalog/buttons/\n-->\n\n# Buttons\n\n[Buttons](https://material.io/components/buttons/) allow users to take actions, and make choices, with a single tap.\n\nThere are four types of buttons:\n\n1. [Text button](#text-button)\n2. [Outlined button](#outlined-button)\n3. [Contained button](#contained-button)\n4. [Toggle button](#toggle-button)\n\n**Note: Toggle buttons are implemented using the `mdc-icon-button` component.\nFor more information, see the [`mdc-icon-button` page](../mdc-icon-button).**\n\n![Example of the four button types](images/buttons_types.png)\n\n## Using buttons\n\n### Installation\n\n```\nnpm install @material/button\n```\n\n### Styles\n\n```scss\n@use \"@material/button/styles\";\n```\n\n### JavaScript instantiation\n\nThe button will work without JavaScript, but you can enhance it to have a ripple effect by instantiating `MDCRipple` on the root element. See [MDC Ripple](../mdc-ripple) for details.\n\n```js\nimport {MDCRipple} from '@material/ripple';\n\nconst buttonRipple = new MDCRipple(document.querySelector('.mdc-button'));\n```\n\n**Note: See [Importing the JS component](../../docs/importing-js.md) for more information on how to import JavaScript.**\n\n### Making buttons accessible\n\nMaterial Design spec advises that touch targets should be at least 48 x 48 px.\nTo meet this requirement, add the following to your button:\n\n```html\n<div class=\"mdc-touch-target-wrapper\">\n  <button class=\"mdc-button mdc-button--touch\">\n    <span class=\"mdc-button__ripple\"></span>\n    <span class=\"mdc-button__touch\"></span>\n    <span class=\"mdc-button__focus-ring\"></span>\n    <span class=\"mdc-button__label\">My Accessible Button</span>\n  </button>\n</div>\n```\n**Note: The outer `mdc-touch-target-wrapper` element is only necessary if you want to avoid potentially overlapping touch targets on adjacent elements (due to collapsing margins).**\n\nThe `mdc-button__focus-ring` element ensures that a focus indicator is displayed in high contrast mode around the active/focused button.\n\n## Text button\n\n[Text buttons](https://material.io/components/buttons/#text-button) are typically used for less-pronounced actions, including those located in dialogs and cards. In cards, text buttons help maintain an emphasis on card content.\n\n### Text button example\n\n<img src=\"images/text-button.png\" alt=\"Text button example\">\n\n```html\n <button class=\"mdc-button\">\n   <span class=\"mdc-button__ripple\"></span>\n   <span class=\"mdc-button__focus-ring\"></span>\n   <span class=\"mdc-button__label\">Text Button</span>\n</button>\n```\n\n<b>Text button with icon example</b>\n\n<img src=\"images/text-icon-button.png\" alt=\"Text button with bookmark icon example\">\n\n```html\n<button class=\"mdc-button mdc-button--icon-leading\">\n  <span class=\"mdc-button__ripple\"></span>\n  <span class=\"mdc-button__focus-ring\"></span>\n  <i class=\"material-icons mdc-button__icon\" aria-hidden=\"true\"\n    >bookmark</i\n  >\n  <span class=\"mdc-button__label\">Text Button plus icon</span>\n</button>\n\n```\n\n## Outlined button\n\n[Outlined buttons](https://material.io/components/buttons/#outlined-button) are medium-emphasis buttons. They contain actions that are important, but aren’t the primary action in an app.\n\n### Outlined button example\n\n<img src=\"images/outlined-button.png\" alt=\"Outlined button example\">\n\n```html\n<button class=\"mdc-button mdc-button--outlined\">\n  <span class=\"mdc-button__ripple\"></span>\n  <span class=\"mdc-button__focus-ring\"></span>\n  <span class=\"mdc-button__label\">Outlined Button</span>\n</button>\n```\n\n<b>Outlined button with icon example</b>\n\n<img src=\"images/outlined-icon-button.png\" alt=\"Outlined button with bookmark icon\">\n\n```html\n<button class=\"mdc-button mdc-button--outlined mdc-button--icon-leading\">\n  <span class=\"mdc-button__ripple\"></span>\n  <span class=\"mdc-button__focus-ring\"></span>\n  <i class=\"material-icons mdc-button__icon\" aria-hidden=\"true\">bookmark</i>\n  <span class=\"mdc-button__label\">Outlined Button plus Icon</span>\n</button>\n```\n\n## Contained button\n\n[Contained buttons](https://material.io/components/buttons/#contained-button) are high-emphasis, distinguished by their use of elevation and fill. They contain actions that are primary to your app.\n\n### Contained button example\n\n<img src=\"images/contained-button.png\" alt=\"Contained button example\">\n\n```html\n<button class=\"mdc-button mdc-button--raised\">\n  <span class=\"mdc-button__ripple\"></span>\n  <span class=\"mdc-button__focus-ring\"></span>\n  <span class=\"mdc-button__label\">Contained Button</span>\n</button>\n```\n\n**Note: `mdc-button--raised` is applied for a contained button with elevation,\nand `mdc-button--unelevated` is applied for a contained button flush with the surface.**\n\n<b>Contained button with icon example</b>\n\n<img src=\"images/contained-icon-button.png\" alt=\"Contained button with a bookmark icon\">\n\n```html\n<button class=\"mdc-button mdc-button--raised mdc-button--icon-leading\">\n  <span class=\"mdc-button__ripple\"></span>\n  <span class=\"mdc-button__focus-ring\"></span>\n  <i class=\"material-icons mdc-button__icon\" aria-hidden=\"true\"\n    >bookmark</i\n  >\n  <span class=\"mdc-button__label\">Contained Button plus Icon</span>\n</button>\n```\n\n## Toggle button\n\n[Toggle buttons](https://material.io/components/buttons/#toggle-button) can be used to select from a group of choices.\n\nThere are two types of toggle buttons:\n\n* [Toggle button](#toggle-button)\n* [Icon](#icon)\n\n<img src=\"images/toggle-bar.png\" alt=\"toggle button group\">\n\nMDC Web currently does not support toggle button groups.\n\n### Icon\n\nIcons can be used as toggle buttons when they allow selection, or deselection, of a single choice, such as marking an item as a favorite.\n\nFor more details, see the [`mdc-icon-button` page](../mdc-icon-button).\n\n## Other Variants\n\n### Icon\n\nWe recommend using [Material Icons](https://material.io/tools/icons/) from Google Fonts:\n\n```html\n<head>\n  <link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/icon?family=Material+Icons\">\n</head>\n```\n\nHowever, you can also use SVG, [Font Awesome](https://fontawesome.com/), or any other icon library you wish.\n\nTo add an icon, add an element with the `mdc-button__icon` class inside the button element and set the attribute `aria-hidden=\"true\"`. The icon is set to 18px to meet legibility requirements.\n\n```html\n<button class=\"mdc-button\">\n  <span class=\"mdc-button__ripple\"></span>\n  <span class=\"mdc-button__focus-ring\"></span>\n  <i class=\"material-icons mdc-button__icon\" aria-hidden=\"true\">favorite</i>\n  <span class=\"mdc-button__label\">Button</span>\n</button>\n```\n\nIt's also possible to use an SVG icon:\n\n```html\n<button class=\"mdc-button\">\n  <span class=\"mdc-button__ripple\"></span>\n  <span class=\"mdc-button__focus-ring\"></span>\n  <svg class=\"mdc-button__icon\" aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"...\">\n  ...\n  </svg>\n  <span class=\"mdc-button__label\">Button</span>\n</button>\n```\n\n#### Trailing Icon\n\nCertain icons make more sense to appear after the button's text label rather than before. This can be accomplished by\nputting the icon markup _after_ the `mdc-button__label` element.\n\n```html\n<button class=\"mdc-button mdc-button--icon-trailing\">\n  <span class=\"mdc-button__ripple\"></span>\n  <span class=\"mdc-button__focus-ring\"></span>\n  <span class=\"mdc-button__label\">Button</span>\n  <i class=\"material-icons mdc-button__icon\" aria-hidden=\"true\">favorite</i>\n</button>\n```\n\n**Note: The `mdc-button__label` element is _required_ in order for the trailing icon to be styled appropriately.**\n\n### Disabled\n\nTo disable a button, add the `disabled` attribute directly to the `<button>`, or set the `disabled` attribute on the `<fieldset>` containing the button.\nDisabled buttons cannot be interacted with and have no visual interaction effect.\n\n```html\n<button class=\"mdc-button\" disabled>\n  <span class=\"mdc-button__ripple\"></span>\n  <span class=\"mdc-button__focus-ring\"></span>\n  <span class=\"mdc-button__label\">Button</span>\n</button>\n```\n\n## Button theming example\n\nThe following example shows text, contained, and outlined button types with Material Theming.\n\n<img src=\"images/button-theming.png\" width=\"400\" alt=\"Button theming with three buttons - text, contained, and outlined - with Shrine theming.\">\n\n### Theming with Sass variables\n\nBefore importing any MDC Web modules, set the theme colors in your Sass file:\n\n```scss\n@use \"@material/theme\" with (\n  $primary: #FEDBD0,\n  $on-primary: #442C2E\n);\n```\n\nIn this case we also want to customize the label color of the text and outlined\nbuttons, to fulfill color contrast requirements. Assuming that you've applied\nthe `custom-text-button` and `custom-outlined-button` classes to your buttons:\n\n```scss\n@use \"@material/button\";\n\n.custom-text-button,\n.custom-outlined-button {\n  @include button.ink-color(#84565E);\n}\n```\n\n### Theming with CSS custom properties\n\nIf you want to customize the theme for buttons without changing the theme\nacross the app, you can also use CSS custom properties:\n\n```scss\n@use \"@material/button\";\n\n.custom-text-button,\n.custom-outlined-button {\n  --mdc-theme-primary: #FEDBD0;\n  --mdc-theme-on-primary: #442C2E;\n\n  @include button.ink-color(#84565E);\n}\n```\n\nFor a more information on theming in general, see\n[this page](../../docs/theming.md).\n\n## API\n\n### CSS classes\n\nCSS Class | Description\n--- | ---\n`mdc-button` | Mandatory. Defaults to a text button that is flush with the surface.\n`mdc-button__ripple` | Mandatory. Indicates the element which shows the ripple styling.\n`mdc-button--raised` | Optional. Styles a contained button that is elevated above the surface.\n`mdc-button--unelevated` | Optional. Styles a contained button that is flush with the surface.\n`mdc-button--outlined` | Optional. Styles an outlined button that is flush with the surface.\n`mdc-button--icon-leading` | Optional. Styles a button with a leading icon.\n`mdc-button--icon-trailing` | Optional. Styles a button with a trailing icon.\n`mdc-button__label` | Recommended.\\* Indicates the element containing the button's text label.\n`mdc-button__icon` | Optional. Indicates the element containing the button's icon.\n`mdc-button__focus-ring` | Recommended. Indicates the element which shows the high contrast mode focus ring styling.\n\n**Note: The `mdc-button__label` element is required for buttons with a trailing icon, but it is currently optional for\n buttons with no icon or a leading icon. In the latter cases, it is acceptable for the text label to simply exist\n directly within the `mdc-button` element.<br>\n However, the `mdc-button__label` class may become mandatory for all cases in the future so we recommend always including it.**\n\n### Sass mixins\n\nTo customize a button's color and properties, you can use the following mixins.\n\n#### Basic Sass mixins\n\nMDC Button uses [MDC Theme](../mdc-theme)'s `primary` color by default. Use the following mixins to customize it.\n\nMixin | Description\n--- | ---\n`filled-accessible($container-fill-color)` | Sets the container fill color for a contained (_raised_ or _unelevated_) button, and updates the button's ink, icon, and ripple colors to meet accessibility standards\n\n#### Advanced Sass mixins\n\nThese mixins will override the color of the container, ink, outline or ripple. It is up to you to ensure your button meets accessibility standards.\n\nMixin | Description\n--- | ---\n`container-fill-color($color-or-map)` | If a color is passed, sets the default container fill color to the given color. If a map is passed whose keys are in the set {default, hover, focus, pressed, disabled}, sets the color in each specified state to its corresponding value.\n`icon-color($color-or-map)` | If a color is passed, sets the default icon color to the given color. If a map is passed whose keys are in the set {default, hover, focus, pressed, disabled}, sets the color in each specified state to its corresponding value.\n`ink-color($color-or-map)` | If a color is passed, sets the default ink color to the given color, and sets the icon color to the given color unless `icon-color` is also used. If a map is passed whose keys are in the set {default, hover, focus, pressed, disabled}, sets the color in each specified state to its corresponding value.\n`density($density-scale)` | Sets density scale for button. Supported density scale values (`-3`, `-2`, `-1`, `0`).\n`height($height)` | Sets custom height for button.\n`shape-radius($radius, $density-scale, $rtl-reflexive)` | Sets rounded shape to button with given radius size. `$density-scale` is only required when `$radius` value is in percentage unit, defaults to `$density-default-scale`. Set `$rtl-reflexive` to true to flip radius values in RTL context, defaults to false.\n`horizontal-padding($padding)` | Sets horizontal padding to the given number.\n`outline-color($color-or-map)` | If a color is passed, sets the default outline color to the given color. If a map is passed whose keys are in the set {default, hover, focus, pressed, disabled}, sets the color in each specified state to its corresponding value.\n`outline-width($width, $padding)` | Sets the outline width to the given number (defaults to 2px) and adjusts padding accordingly. `$padding` is only required in cases where `$horizontal-padding` is also included with a custom value.\n","gitHead":"46484a77ecd0c6d7b548301f4e92325ffc4f8010","license":"MIT","_npmUser":{"name":"abhiomkar","email":"abhiomkar@gmail.com"},"homepage":"https://github.com/material-components/material-components-web#readme","keywords":["material components","material design","button"],"repository":{"url":"git+https://github.com/material-components/material-components-web.git","type":"git","directory":"packages/mdc-button"},"_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","description":"The Material Components for the web button component","directories":{},"maintainers":[{"name":"material-admin","email":"aprigogin+npm@google.com"},{"name":"yefim","email":"hi@yef.im"},{"name":"abhiomkar","email":"abhiomkar@gmail.com"},{"name":"azakus","email":"dfreedm2@gmail.com"},{"name":"bicknellr","email":"bicknellr@gmail.com"},{"name":"aprigogin","email":"andrey.prigogin@gmail.com"},{"name":"patrickrodee","email":"prodee@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":"14.18.1","dependencies":{"tslib":"^2.1.0","@material/dom":"14.0.0-canary.bbd11268f.0","@material/rtl":"14.0.0-canary.bbd11268f.0","@material/shape":"14.0.0-canary.bbd11268f.0","@material/theme":"14.0.0-canary.bbd11268f.0","@material/ripple":"14.0.0-canary.bbd11268f.0","@material/tokens":"14.0.0-canary.bbd11268f.0","@material/density":"14.0.0-canary.bbd11268f.0","@material/elevation":"14.0.0-canary.bbd11268f.0","@material/focus-ring":"14.0.0-canary.bbd11268f.0","@material/typography":"14.0.0-canary.bbd11268f.0","@material/touch-target":"14.0.0-canary.bbd11268f.0","@material/feature-targeting":"14.0.0-canary.bbd11268f.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/button_14.0.0-canary.bbd11268f.0_1637706791765_0.3906764200688366","host":"s3://npm-registry-packages"},"_id":"@material/button@14.0.0-canary.bbd11268f.0","version":"14.0.0-canary.bbd11268f.0"}