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

@m3e/fab

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

FAB for M3E

latest
Source
npmnpm
Version
1.3.1
Version published
Weekly downloads
11
-59.26%
Maintainers
1
Weekly downloads
 
Created
Source

@m3e/fab

The m3e-fab component is a prominent, expressive UI component that represents the primary action on a screen. Designed according to Material Design 3 guidelines, it supports seven visual variants, specified using the variant attribute—primary, primary-container, secondary, secondary-container, tertiary, tertiary-container and surface—each with dynamic elevation and adaptive color theming.

The component is accessible by default, with ARIA roles, contrast-safe color tokens, and strong focus indicators. It can be extended to display a label alongside its icon, and responds to interaction states (hover, focus, press, disabled) with smooth motion transitions, elevation changes, and adaptive color theming. 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-fab 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/fab

💻 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/fab, 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/fab/dist/html-custom-data.json"],
  "css.customData": ["./node_modules/@m3e/fab/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/fab/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-fab — A floating action button (FAB) used to present important actions.

🧪 Examples

The following example illustrates a basic floating action button.

<m3e-fab>
  <m3e-icon>add</m3e-icon>
</m3e-fab>

The next example illustrates an extended floating action button.

<m3e-fab extended>
  <m3e-icon>add</m3e-icon>
  <span slot="label">Add</span>
</m3e-fab>

📖 API Reference

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

⚙️ Attributes

AttributeTypeDefaultDescription
variant"primary" | "primary-container" | "secondary" | "secondary-container" | "tertiary" | "tertiary-container" | "surface""primary-container"The appearance variant of the FAB.
size"small" | "medium" | "large""medium"The size of the FAB.
extendedbooleanfalseWhether the FAB is extended to show the label.
loweredbooleanfalseWhether to present a lowered elevation.
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 FAB points.
targetstringThe target of the link FAB.
relstringThe relationship between the target of the link FAB and the document.
downloadstringA value indicating whether the target of the link FAB will be downloaded, optionally specifying the new name of the file.

🧩 Slots

SlotDescription
(default)Renders the icon of the button.
labelRenders the label of an extended FAB.
close-iconRenders the close icon when used to open a FAB menu.

🎛️ CSS Custom Properties

🧱 Size Properties

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

PropertyDescription
--m3e-fab-[size]-container-heightHeight of the FAB container
--m3e-fab-[size]-label-text-font-sizeFont size for label
--m3e-fab-[size]-label-text-font-weightFont weight for label
--m3e-fab-[size]-label-text-line-heightLine height for label
--m3e-fab-[size]-label-text-trackingLetter tracking for label
--m3e-fab-[size]-icon-sizeIcon size
--m3e-fab-[size]-shapeCorner radius
--m3e-fab-[size]-leading-spaceSpace before icon/label
--m3e-fab-[size]-trailing-spaceSpace after icon/label
--m3e-fab-[size]-icon-label-spaceSpace between icon and label

🎨 Appearance Variant Properties

All appearance variants (primary, primary-container, secondary, secondary-container, tertiary, tertiary-container, surface) support:

PropertyDescription
--m3e-[variant]-fab-label-text-colorLabel color
--m3e-[variant]-fab-icon-colorIcon color
--m3e-[variant]-fab-container-colorContainer background color
--m3e-[variant]-fab-container-elevationElevation
--m3e-[variant]-fab-lowered-container-elevationLowered elevation

🟫 State Properties

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

PropertyDescription
--m3e-[variant]-fab-disabled-label-text-colorLabel color when disabled
--m3e-[variant]-fab-disabled-label-text-opacityLabel opacity when disabled
--m3e-[variant]-fab-disabled-icon-colorIcon color when disabled
--m3e-[variant]-fab-disabled-icon-opacityIcon opacity when disabled
--m3e-[variant]-fab-disabled-container-colorContainer color when disabled
--m3e-[variant]-fab-disabled-container-opacityContainer opacity when disabled
--m3e-[variant]-fab-disabled-container-elevationElevation when disabled
--m3e-[variant]-fab-lowered-disabled-container-elevationLowered elevation when disabled
--m3e-[variant]-fab-hover-label-text-colorLabel color on hover
--m3e-[variant]-fab-hover-icon-colorIcon color on hover
--m3e-[variant]-fab-hover-state-layer-colorState layer color on hover
--m3e-[variant]-fab-hover-state-layer-opacityState layer opacity on hover
--m3e-[variant]-fab-hover-container-elevationElevation on hover
--m3e-[variant]-fab-lowered-hover-container-elevationLowered elevation on hover
--m3e-[variant]-fab-focus-label-text-colorLabel color on focus
--m3e-[variant]-fab-focus-icon-colorIcon color on focus
--m3e-[variant]-fab-focus-state-layer-colorState layer color on focus
--m3e-[variant]-fab-focus-state-layer-opacityState layer opacity on focus
--m3e-[variant]-fab-focus-container-elevationElevation on focus
--m3e-[variant]-fab-lowered-focus-container-elevationLowered elevation on focus
--m3e-[variant]-fab-pressed-label-text-colorLabel color on press
--m3e-[variant]-fab-pressed-icon-colorIcon color on press
--m3e-[variant]-fab-pressed-state-layer-colorState layer color on press
--m3e-[variant]-fab-pressed-state-layer-opacityState layer opacity on press
--m3e-[variant]-fab-pressed-container-elevationElevation on press
--m3e-[variant]-fab-lowered-pressed-container-elevationLowered elevation on press

🤝 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