← All Components
<mth-fab>
Floating Action Button supporting compact circular, extended pill, and logical viewport corner placement.
When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.
Live Interactive Preview
Ready · interact with <mth-fab>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/fab"></script>
<mth-fab variant="primary" size="sm">Example</mth-fab>import '@methane-ui/ui/fab';
import '@methane-ui/react';
export function Example() {
return <mth-fab variant="primary" size="sm">Example</mth-fab>;
}<script setup lang="ts">
import '@methane-ui/ui/fab';
</script>
<template>
<mth-fab variant="primary" size="sm">Example</mth-fab>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/fab';
import { MthFabDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthFabDirective],
template: `<mth-fab variant="primary" size="sm">Example</mth-fab>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/fab';
import MthFab from '@methane-ui/svelte/MthFab.svelte';
</script>
<MthFab variant="primary" size="sm">Example</MthFab>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
label | label | string | "" | Accessible label (aria-label when icon-only, fallback text when extended). |
variant | variant | 'primary' | 'surface' | 'secondary' | "primary" | Visual treatment (primary, surface, or secondary). |
size | size | 'sm' | 'md' | 'lg' | "md" | Dimension scale (sm, md, or lg). |
extended | extended | boolean | false | Displays text label alongside the icon. |
disabled | disabled | boolean | false | Disables interaction. |
fixed | fixed | boolean | false | Pins the FAB to a logical viewport corner using placement. |
placement | placement | 'bottom-end' | 'bottom-start' | 'top-end' | 'top-start' | "bottom-end" | Logical corner placement when fixed is enabled. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-press | { originalEvent: Event } | Cancelable event fired when the FAB is activated. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | FAB is focused and enabled | Emits mth-press |
both | FAB is focused and enabled | Emits mth-press |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | delegatesFocus: true with zero host internals.role (ADR-014). | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 2 APG keyboard transitions across LTR/RTL. | mth-fab.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(disabled), :state(extended). | Conformance suite |
| i18n | Routes 1 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |