← All Components
<mth-icon-button>
Accessible icon-only action or toggle button requiring an explicit label.
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-icon-button>, or toggle Theme, Direction (LTR/RTL), or props above.
Live Variants & States Showcase
variant="solid"
variant="outline"
variant="ghost"
variant="danger"
sizes (sm / md / lg)★ ★ ★
loading & disabled★ ★
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/icon-button"></script>
<mth-icon-button variant="solid" size="sm">Example</mth-icon-button>import '@methane-ui/ui/icon-button';
import '@methane-ui/react';
export function Example() {
return <mth-icon-button variant="solid" size="sm">Example</mth-icon-button>;
}<script setup lang="ts">
import '@methane-ui/ui/icon-button';
</script>
<template>
<mth-icon-button variant="solid" size="sm">Example</mth-icon-button>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/icon-button';
import { MthIconButtonDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthIconButtonDirective],
template: `<mth-icon-button variant="solid" size="sm">Example</mth-icon-button>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/icon-button';
import MthIconButton from '@methane-ui/svelte/MthIconButton.svelte';
</script>
<MthIconButton variant="solid" size="sm">Example</MthIconButton>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
label | label | string | "" | Required accessible name forwarded to inner aria-label. Emits a dev warning if empty. |
variant | variant | 'solid' | 'outline' | 'ghost' | 'danger' | "ghost" | Visual emphasis variant. |
size | size | 'sm' | 'md' | 'lg' | "md" | Square control size scale. |
disabled | disabled | boolean | false | Disables interaction. |
loading | loading | boolean | false | Shows loading spinner and suppresses activation. |
pressed | pressed | boolean | undefined | — | Optional toggle state (true | false); sets aria-pressed when defined. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-press | { originalEvent: Event } | Fired when activated while enabled and not loading. |
mth-change | { pressed: boolean } | Fired when a toggleable icon button (pressed !== undefined) changes state. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | Icon button is focused and enabled | Emits mth-press and toggles pressed state when defined |
both | Icon button is focused and enabled | Emits mth-press and toggles pressed state when defined |
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-icon-button.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(disabled), :state(loading), :state(pressed). | Conformance suite |
| i18n | Routes 1 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |