New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@m3e/icon-button

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@m3e/icon-button

Icon Button for M3E

latest
Source
npmnpm
Version
1.3.1
Version published
Weekly downloads
24
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

@m3e/icon-button

The m3e-icon-button component is a semantic, expressive UI primitive for triggering actions with a single icon. Designed according to Material Design 3 guidelines, it supports four visual variants, specified using the variant attribute—filled, tonal, outlined, and standard—each with dynamic elevation, shape morphing, and adaptive color theming. The component responds to interaction states (hover, focus, press, disabled) with smooth motion transitions, ensuring emotional clarity and visual hierarchy.

The component is accessible by default, with ARIA roles, contrast-safe color tokens, and strong focus indicators. It supports optional icons and states for binary actions. When using m3e-icon for icons, filled is automatically set based on the selected state of a toggle button. It can also function as a link or be used to submit form data.

Native disabled <button> elements cannot receive focus. This can be problematic in some cases because it can prevent you from telling the user why the button is disabled. You can use the disabled-interactive attribute to style a m3e-icon-button as disabled but allow for it to receive focus. The button will have aria-disabled="true" for assistive technology.

This package is part of M3E monorepo, a unified suite of Material 3 web components. Explore the docs to see them in action.

📦 Installation

npm install @m3e/icon-button

💻 Editor Integration

This package includes a Custom Elements Manifest to support enhanced editor tooling and developer experience.

Visual Studio Code

To enable autocomplete and hover documentation for @m3e/icon-button, install the Custom Elements Manifest Language Server extension. It will automatically detect the manifest bundled with this package and surface tag names, attributes, slots, and events in supported files.

Alternately, you can explicitly reference the html-custom-data.json and css-custom-data.json in your workspace settings:

{
  "html.customData": ["./node_modules/@m3e/icon-button/dist/html-custom-data.json"],
  "css.customData": ["./node_modules/@m3e/icon-button/dist/css-custom-data.json"]
}

🚀 Native Module Support

This package uses JavaScript Modules. To use it directly in a browser without a bundler, use a module script similar to the following.

<script type="module" src="/node_modules/@m3e/icon-button/dist/index.js"></script>

In addition, you must use an import map to include dependencies.

<script type="importmap">
  {
    "imports": {
      "lit": "https://cdn.jsdelivr.net/npm/lit@3.3.0/+esm",
      "@m3e/core": "/node_modules/@m3e/core/dist/index.js"
    }
  }
</script>

For production, use index.min.js for faster load times.

🗂️ Elements

  • m3e-icon-button — An icon button users interact with to perform a supplementary action.

🧪 Examples

The following example illustrates changing the appearance from standard (default) to filled using the variant attribute, changing the size using the size attribute, and enabling toggle behavior using the toggle attribute.

<m3e-icon-button variant="filled" size="large" toggle selected>
  <m3e-icon name="favorite"></m3e-icon>
</m3e-icon-button>

📖 API Reference

This section details the attributes, slots and CSS custom properties available for the m3e-icon-button component.

⚙️ Attributes

AttributeTypeDefaultDescription
variant"standard" | "outlined" | "filled" | "tonal""standard"The appearance variant of the button.
shape"rounded" | "square""rounded"The shape of the button.
size"extra-small" | "small" | "medium" | "large""small"The size of the button.
width"narrow" | "default" | "wide""default"The width of the button.
togglebooleanfalseWhether the button will toggle between selected and unselected states.
selectedbooleanfalseWhether the toggle button is selected.
disabledbooleanfalseWhether the element is disabled.
disabled-interactivebooleanfalseWhether the element is disabled and interactive.
type"button" | "submit" | "reset""button"The type of the element.
namestringThe name of the element, submitted as a pair with the element's value as part of form data, when the element is used to submit a form.
valuestringThe value associated with the element's name when it's submitted with form data.
hrefstringThe URL to which the link button points.
targetstringThe target of the link button.
relstringThe relationship between the target of the link button and the document.
downloadstringA value indicating whether the target of the link button will be downloaded, optionally specifying the new name of the file.

🧩 Slots

SlotDescription
(default)Renders the icon of the button.
selectedRenders an icon when selected (toggle).

🎛️ CSS Custom Properties

🧱 Size Properties

All size variants (extra-small, small, medium, large, extra-large) support:

PropertyDescription
--m3e-icon-button-[size]-container-heightHeight of the button container
--m3e-icon-button-[size]-outline-thicknessOutline thickness
--m3e-icon-button-[size]-icon-sizeIcon size
--m3e-icon-button-[size]-shape-roundCorner radius for round shape
--m3e-icon-button-[size]-shape-squareCorner radius for square shape
--m3e-icon-button-[size]-selected-shape-roundCorner radius when selected (round)
--m3e-icon-button-[size]-selected-shape-squareCorner radius when selected (square)
--m3e-icon-button-[size]-shape-pressed-morphCorner radius when pressed
--m3e-icon-button-[size]-narrow-leading-spaceSpace before icon (narrow width)
--m3e-icon-button-[size]-narrow-trailing-spaceSpace after icon (narrow width)
--m3e-icon-button-[size]-default-leading-spaceSpace before icon (default width)
--m3e-icon-button-[size]-default-trailing-spaceSpace after icon (default width)
--m3e-icon-button-[size]-wide-leading-spaceSpace before icon (wide width)
--m3e-icon-button-[size]-wide-trailing-spaceSpace after icon (wide width)

🎨 Appearance Variant Properties

All appearance variants (standard, outlined, filled, tonal) support the following properties (replace [variant] with the variant name):

PropertyDescription
--m3e-[variant]-icon-button-icon-colorIcon color
--m3e-[variant]-icon-button-container-colorContainer background color
--m3e-[variant]-icon-button-outline-colorOutline color (outlined only)

🟫 State Properties

Each variant supports state properties for disabled, hover, focus, pressed, selected, and unselected. For each variant, the following properties are available (replace [variant] with the variant name):

PropertyDescription
--m3e-[variant]-icon-button-disabled-container-colorContainer color when disabled
--m3e-[variant]-icon-button-disabled-container-opacityContainer opacity when disabled
--m3e-[variant]-icon-button-disabled-icon-colorIcon color when disabled
--m3e-[variant]-icon-button-disabled-icon-opacityIcon opacity when disabled
--m3e-[variant]-icon-button-disabled-outline-colorOutline color when disabled (outlined)
--m3e-[variant]-icon-button-hover-icon-colorIcon color on hover
--m3e-[variant]-icon-button-hover-outline-colorOutline color on hover (outlined)
--m3e-[variant]-icon-button-hover-state-layer-colorState layer color on hover
--m3e-[variant]-icon-button-hover-state-layer-opacityState layer opacity on hover
--m3e-[variant]-icon-button-hover-unselected-icon-colorUnselected icon color on hover
--m3e-[variant]-icon-button-hover-unselected-state-layer-colorUnselected state layer color on hover
--m3e-[variant]-icon-button-hover-selected-icon-colorSelected icon color on hover
--m3e-[variant]-icon-button-hover-selected-state-layer-colorSelected state layer color on hover
--m3e-[variant]-icon-button-focus-icon-colorIcon color on focus
--m3e-[variant]-icon-button-focus-outline-colorOutline color on focus (outlined)
--m3e-[variant]-icon-button-focus-state-layer-colorState layer color on focus
--m3e-[variant]-icon-button-focus-state-layer-opacityState layer opacity on focus
--m3e-[variant]-icon-button-focus-unselected-icon-colorUnselected icon color on focus
--m3e-[variant]-icon-button-focus-unselected-state-layer-colorUnselected state layer color on focus
--m3e-[variant]-icon-button-focus-selected-icon-colorSelected icon color on focus
--m3e-[variant]-icon-button-focus-selected-state-layer-colorSelected state layer color on focus
--m3e-[variant]-icon-button-pressed-icon-colorIcon color on press
--m3e-[variant]-icon-button-pressed-outline-colorOutline color on press (outlined)
--m3e-[variant]-icon-button-pressed-state-layer-colorState layer color on press
--m3e-[variant]-icon-button-pressed-state-layer-opacityState layer opacity on press
--m3e-[variant]-icon-button-pressed-unselected-icon-colorUnselected icon color on press
--m3e-[variant]-icon-button-pressed-unselected-state-layer-colorUnselected state layer color on press
--m3e-[variant]-icon-button-pressed-selected-icon-colorSelected icon color on press
--m3e-[variant]-icon-button-pressed-selected-state-layer-colorSelected state layer color on press

🟦 Selected/Unselected State Properties

For toggle buttons, each variant supports selected/unselected state properties:

PropertyDescription
--m3e-[variant]-icon-button-selected-icon-colorIcon color when selected
--m3e-[variant]-icon-button-selected-container-colorContainer color when selected
--m3e-[variant]-icon-button-selected-state-layer-colorState layer color when selected
--m3e-[variant]-icon-button-unselected-icon-colorIcon color when unselected
--m3e-[variant]-icon-button-unselected-container-colorContainer color when unselected
--m3e-[variant]-icon-button-unselected-state-layer-colorState layer color when unselected

🤝 Contributing

See the root monorepo CONTRIBUTING.md for guidelines on contributing to this package.

📄 License

This package is licensed under the MIT License.

Keywords

material design

FAQs

Package last updated on 20 Feb 2026

Did you know?

Socket

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.

Install

Related posts