0.27.0 • Published 2 years ago

@material/mwc-icon-button v0.27.0

Weekly downloads
5,547
License
Apache-2.0
Repository
github
Last release
2 years ago

<mwc-icon-button> Published on npm

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

Demo

Installation

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.

Example Usage

Standard

<mwc-icon-button icon="code"></mwc-icon-button>

SVG or Image

<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>

Disabled

<mwc-icon-button icon="code" disabled></mwc-icon-button>

Custom Style

mwc-icon-button {
  color: tomato;
  --mdc-icon-size: 50px;
}

Fonts

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.

API

Slots

NameDescription
defaultOptional <img> or <svg> to display instead of using an icon font

Properties/Attributes

NameTypeDefaultDescription
aria-haspopupstringundefinedIndicates the availability and type of an interactive popup element, such as menu or dialog, that can be triggered by the button.
iconstring''Icon to display, and aria-label value when label is not defined.
aria-labelstring''Accessible label for the button.
disabledbooleanfalseDisabled buttons cannot be interacted with and have no visual interaction effect.

Methods

None

Events

None

CSS Custom Properties

Inherits CSS Custom properties from:

NameDefaultDescription
--mdc-icon-button-size48pxSets the size of the button wrapping the icon.

Global Custom Properties

This component exposes the following global theming custom properties.

NameDescription
--mdc-icon-fontFont that supports ligatures and determines which icons are available (see fonts above).
--mdc-icon-sizeSets the size of the icon.
--mdc-theme-text-disabled-on-lightColor of icon when disabled is true.

Additional references

fundwave-fund-management@material/mwc-icon-button-togglezagenzagen-productionplaytwo-core-cms-sectionsbf-forms@simplr-wc/icon-button@simplr-wc/top-app-barsimplr-components@cryptobash/kernelopenstamanager@everything-registry/sub-chunk-584open-scd@erixhens/annotatorhomeassistant-frontend-racelandholochain-playgroundjsui-componentsjupyter_pixanojvx-multiselectkt-playground-elementsimprov-wifi-serial-sdklit-number-stepperlit-p2p@backlight-dev/aodocs.aodocs-design-system@bfchain/dweb-browser@batchforce/core@ascenso/crca-notification-sound@ascenso/crca-stepper@blackpurl/web-components@bluetensor/annotator@aurodesignsystem/auro-datepicker@dotcms/dotcms-ui@dman777/lit-time-picker@esui/material-components@equinor/fusion-wc-icon-button@equinor/fusion-wc-icon-button-toggle@equinor/fusion-wc-button@dwane-vonage/vve-participants@exmg/test-exmg-dialogs@fortit/fwc-chip@fortit/fwc-chip-list@fortit/fwc-data-table@hass-ada/frontend-lite@fine-app-design/some-thing@finastra/icon-button@jsview/material-components@jrg/ubuntu-ui@jrg/main-ui-private@jrg-material/material@leavittsoftware/leavitt-file-explorer@leavittsoftware/leavittbook@leavittsoftware/titanium-attachment-input@leavittsoftware/titanium-chip@leavittsoftware/titanium-data-table@leavittsoftware/titanium-header@leavittsoftware/titanium-image-input@leavittsoftware/titanium-search-input@leavittsoftware/titanium-smart-attachment-inputpdf-viewer-elementmwc-pwa-reloadplayground-elementsplayground-elements-ashmde-ultimatepgljupyterscoped-material-componentsruhil-uisaby-customizershadow-prototypetasmota-esp-web-toolsswag-tag-mwcux-hub-entity-menuux-hub-product-cardwc-range-datepickervve-breakoutvve-participantsyew-material-scripts@jrg/dropdown@_lucky/app-datepicker@jcdomber/grte-cat-menu@lordoftheflies/plutonium-styles@infinitebrahmanuniverse/nolb-_mate@maicol07/mwa-data-table@maicol07/mwa-icon-button@npm_lucky/app-datepicker@openscd/open-scd-core@openscd/oscd-filtered-list@operato/scene-chartjs@pixano/core@openenergytools/scl-wizarding@nabucasa/sl-web-tools@near-solution/auth-ui@near-solution/help@near-solution/shell@things-factory/shellapp-datepickerboo-wysiwyg-ebrick-viewer@vonage/vwc-icon-button@vonage/vwc-icon-button-toggle@web-mjs/material-components@web-mjs/material-web-components
0.27.0

2 years ago

0.26.1

2 years ago

0.26.0

2 years ago

0.25.3

3 years ago

0.25.2

3 years ago

0.25.1

3 years ago

0.25.0

3 years ago

0.23.0

3 years ago

0.22.1

3 years ago

0.22.0

3 years ago

0.21.0

3 years ago

0.20.0

3 years ago

0.19.1

4 years ago

0.19.0

4 years ago

0.18.0

4 years ago

0.17.2

4 years ago

0.17.0

4 years ago

0.16.1

4 years ago

0.15.0

4 years ago

0.14.1

4 years ago

0.14.0

4 years ago

0.13.0

4 years ago

0.12.0

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.0

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago

0.8.0

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago