Security News
Combatting Alert Fatigue by Prioritizing Malicious Intent
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
@material/mwc-icon-button
Advanced tools
<mwc-icon-button>
IMPORTANT: The Material Web Components are a work in progress and subject to major changes until 1.0 release.
Icon buttons allow users to take actions, and make choices, with a single tap.
For the toggling version of this component, see <mwc-icon-button-toggle>
Material Design Guidelines: Button
npm install @material/mwc-icon-button
NOTE: The Material Web Components are distributed as ES2017 JavaScript Modules, and use the Custom Elements API. They are compatible with all modern browsers including Chrome, Firefox, Safari, Edge, and IE11, but an additional tooling step is required to resolve bare module specifiers, as well as transpilation and polyfills for IE11. See here for detailed instructions.
<mwc-icon-button icon="code"></mwc-icon-button>
<mwc-icon-button>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>
</mwc-icon-button>
<mwc-icon-button icon="code" disabled></mwc-icon-button>
mwc-icon-button {
color: tomato;
--mdc-icon-size: 50px;
}
Most users should include the following in their application HTML when using icons:
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet">
This loads the Material Icons font, which is required to render icons, and is not loaded automatically. If you see plain text instead of an icon, then the most likely cause is that the Material Icons font is not loaded.
To see all icons that are available in the Material Icons font, see Material Icons.
For technical details about the Material Icons font, see the Material Icons Developer Guide.
Name | Description |
---|---|
default | Optional <img> or <svg> to display instead of using an icon font |
Name | Type | Default | Description |
---|---|---|---|
icon | string | '' | Icon to display, and aria-label value when label is not defined. |
label | string | '' | Accessible label for the button, sets aria-label . |
disabled | boolean | false | Disabled buttons cannot be interacted with and have no visual interaction effect. |
None
None
Inherits CSS Custom properties from:
Name | Default | Description |
---|---|---|
--mdc-icon-button-size | 48px | Sets the size of the button wrapping the icon. |
This component exposes the following global theming custom properties.
Name | Description |
---|---|
--mdc-icon-font | Font that supports ligatures and determines which icons are available (see fonts above). |
--mdc-icon-size | Sets the size of the icon. |
--mdc-theme-text-disabled-on-light | Color of icon when disabled is true . |
FAQs
Material Design icon button web component
The npm package @material/mwc-icon-button receives a total of 12,129 weekly downloads. As such, @material/mwc-icon-button popularity was classified as popular.
We found that @material/mwc-icon-button demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.