{"bugs":{"url":"https://github.com/material-components/material-components-web/issues"},"dist":{"shasum":"5ca63d4861911f442fbba5056451be3c90c6a2b4","tarball":"https://registry.npmjs.org/@material/button/-/button-15.0.0-canary.ce9523167.0.tgz","fileCount":40,"integrity":"sha512-gcJDcAG6OHlo/Y4iel1eUTdvVyKHlQROIizIMSyUrlZL73hfT9uuEQ3g32wTZUG6Onq7MsJYeQLy1TcdwEnvxQ==","signatures":[{"sig":"MEUCIQCIXA5Q750OBsxurGEMEq0Osdg+5txkSJ2bLAKLaZBCPAIgOB309+dytqBgg/5n2wztU5B6rM56uvnZUH7XzZAZfIk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":642027,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjNgC0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpmSw/+IflQoaLmvuA5/RT7Nf9qaZ1xcc/QqJf5igNfetpfqG93XpPo\r\n99E2aea/AXSoPCHEhmbLIDxjxiR1H8hJsnpPFwdqx76JvVuqURkMLqHBRUoU\r\nIskWd3+KsAzndtOmKwDWZHlIkeWL8pIzrisWIGdfeF0jt7A3M2tSoR5d4O6P\r\nmZb1B71di2g7M4hFJzKwHgnNsElOZ1Rc4WK3fuV9jRGdV5+VvEu/PU/yaBIe\r\nUsmPTQ3A6zPjPDOoO8PPMm1tI/gXFGNa6C/SkvyQjH7AwC8RWuPrwmI6nAYU\r\nj3sOyg8WQygg75Kp5ODUGMiag/T3YP8WiivJBHHbGNNVYmJU5RkexfVyCmUt\r\nyp6/QSlsSrhxliD094Bk7RVL0VcqFGZiI5A2WIQoRy7pDYKeWzePvbga6vdd\r\nqlf3B1LCWM8eJPIOsa5XHO/T6sYsMLmAPDsHdzgm/jlhSpy2JYBAcDPjw2Ee\r\nL1fjYIftbKt/Xezs3x1UCw3E9rvGSYnJ5aq545VlHUoYwJBasu5iau307vxL\r\nGJ1EEaJ+9FcODJrwTGPagqTV6lBjJ3fZ7opoqZPJOHvVH5vstcKn9JMcnT5/\r\nyWrPC2FUty8vvoVSFyL08C+VcNRp3RMP70oLwgFDeIcrswumI112dTrZ36+w\r\nE0OENPcIxUyPXQ7EGhA5aq9eL6rH8NVNWf8=\r\n=C/Qc\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":"8aac5a80fa36dceacc7b3a6e2474218f9092a107","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.20.0+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.20.0","dependencies":{"tslib":"^2.1.0","@material/dom":"15.0.0-canary.ce9523167.0","@material/rtl":"15.0.0-canary.ce9523167.0","@material/shape":"15.0.0-canary.ce9523167.0","@material/theme":"15.0.0-canary.ce9523167.0","@material/ripple":"15.0.0-canary.ce9523167.0","@material/tokens":"15.0.0-canary.ce9523167.0","@material/density":"15.0.0-canary.ce9523167.0","@material/elevation":"15.0.0-canary.ce9523167.0","@material/focus-ring":"15.0.0-canary.ce9523167.0","@material/typography":"15.0.0-canary.ce9523167.0","@material/touch-target":"15.0.0-canary.ce9523167.0","@material/feature-targeting":"15.0.0-canary.ce9523167.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/button_15.0.0-canary.ce9523167.0_1664483507812_0.6950723508857106","host":"s3://npm-registry-packages"},"_id":"@material/button@15.0.0-canary.ce9523167.0","version":"15.0.0-canary.ce9523167.0"}