FAB Menu for M3E
npm install @m3e/fab-menum3e-fab-menu component presents a dynamic menu of related actions, elegantly revealed from a floating action button (FAB). Designed using expressive, adaptive surfaces, it enables seamless access to contextual actions in modern, visually rich interfaces.
bash
npm install @m3e/fab-menu
`
๐ป Editor Integration
This package includes a Custom Elements Manifest to support enhanced editor tooling and developer experience.
$3
To enable autocomplete and hover documentation for @m3e/fab-menu, 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:
`json
{
"html.customData": ["./node_modules/@m3e/fab-menu/dist/html-custom-data.json"],
"css.customData": ["./node_modules/@m3e/fab-menu/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.
`html
`
You also need a module script for @m3e/fab due to it being a dependency.
`html
`
In addition, you must use an import map to include dependencies.
`html
`
> For production, use index.min.js, a11y.min.js, anchoring.min.js, and bidi.min.js for faster load times.
๐๏ธ Elements
- m3e-fab-menu โ A menu, opened from a floating action button (FAB), used to display multiple related actions.
- m3e-fab-menu-item โ An item of a floating action button (FAB) menu.
- m3e-fab-menu-trigger โ An element used to trigger the opening of a m3e-fab-menu from a FAB.
๐งช Examples
The following example illustrates triggering a m3e-fab-menu from an m3e-fab using a m3e-fab-menu-trigger:
`html
First
Second
Third
Forth
Fifth
Sixth
`
๐ API Reference
$3
This section details the attributes, slots and CSS custom properties available for the m3e-fab-menu component.
#### โ๏ธ Attributes
| Attribute | Type | Default | Description |
| --------- | ---------------------------------------- | ----------- | ----------------------------------- |
| variant | "primary" \| "secondary" \| "tertiary" | "primary" | The appearance variant of the menu. |
#### ๐งฉ Slots
| Slot | Description |
| ----------- | --------------------------------- |
| _(default)_ | Renders the contents of the menu. |
$3
| Property | Description |
| ------------------------------------- | --------------------------------------------------- |
| --m3e-fab-menu-spacing | Vertical gap between menu items. |
| --m3e-fab-menu-max-width | Maximum width of the menu. |
| --m3e-primary-fab-color | Foreground color for primary variant items. |
| --m3e-primary-fab-container-color | Container color for primary variant items. |
| --m3e-primary-fab-hover-color | Hover background color for primary variant items. |
| --m3e-primary-fab-focus-color | Focus background color for primary variant items. |
| --m3e-primary-fab-ripple-color | Ripple color for primary variant items. |
| --m3e-secondary-fab-color | Foreground color for secondary variant items. |
| --m3e-secondary-fab-container-color | Container color for secondary variant items. |
| --m3e-secondary-fab-hover-color | Hover background color for secondary variant items. |
| --m3e-secondary-fab-focus-color | Focus background color for secondary variant items. |
| --m3e-secondary-fab-ripple-color | Ripple color for secondary variant items. |
| --m3e-tertiary-fab-color | Foreground color for tertiary variant items. |
| --m3e-tertiary-fab-container-color | Container color for tertiary variant items. |
| --m3e-tertiary-fab-hover-color | Hover background color for tertiary variant items. |
| --m3e-tertiary-fab-focus-color | Focus background color for tertiary variant items. |
| --m3e-tertiary-fab-ripple-color | Ripple color for tertiary variant items. |
$3
This section details the attributes, slots and CSS custom properties available for the m3e-fab-menu-item component.
#### โ๏ธ Attributes
| Attribute | Type | Default | Description |
| ---------- | --------- | ------- | ----------------------------------------------------- |
| disabled | boolean | false | Whether the element is disabled. |
| download | string | | Download target for the link button. |
| href | string | | The URL to which the link button points. |
| rel | string | | The relationship between the target and the document. |
| target | string | | The target of the link button. |
#### ๐งฉ Slots
| Slot | Description |
| ----------- | ---------------------------------------- |
| _(default)_ | Renders the label of the item. |
| icon | Renders an icon before the item's label. |
$3
| Property | Description |
| ------------------------------------ | -------------------------------------- |
| --m3e-fab-menu-item-height | Height of the menu item. |
| --m3e-fab-menu-item-font-size | Font size of the menu item label. |
| --m3e-fab-menu-item-font-weight | Font weight of the menu item label. |
| --m3e-fab-menu-item-line-height | Line height of the menu item label. |
| --m3e-fab-menu-item-tracking | Letter spacing of the menu item label. |
| --m3e-fab-menu-item-shape | Border radius of the menu item. |
| --m3e-fab-menu-item-leading-space | Padding at the start of the menu item. |
| --m3e-fab-menu-item-trailing-space | Padding at the end of the menu item. |
| --m3e-fab-menu-item-spacing | Gap between icon and label. |
| --m3e-fab-menu-item-icon-size | Size of the icon in the menu item. |
๐ค Contributing
See the root monorepo CONTRIBUTING.md` for guidelines on contributing to this package.