Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-icon-button>

@methane-ui/ui~6.8 KB brotli (cold + Lit)~1.4 KB marginal

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

Interactive StageLive Custom Element · <mth-icon-button> (@methane-ui/ui)
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>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
labellabelstring""Required accessible name forwarded to inner aria-label. Emits a dev warning if empty.
variantvariant'solid' | 'outline' | 'ghost' | 'danger'"ghost"Visual emphasis variant.
sizesize'sm' | 'md' | 'lg'"md"Square control size scale.
disableddisabledbooleanfalseDisables interaction.
loadingloadingbooleanfalseShows loading spinner and suppresses activation.
pressedpressedboolean | undefined—Optional toggle state (true | false); sets aria-pressed when defined.

Events

EventDetail TypeDescription
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

KeyDirectionWhenExpected Behavior
EnterbothIcon button is focused and enabledEmits mth-press and toggles pressed state when defined
bothIcon button is focused and enabledEmits mth-press and toggles pressed state when defined

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusdelegatesFocus: true with zero host internals.role (ADR-014).lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 2 APG keyboard transitions across LTR/RTL.mth-icon-button.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(disabled), :state(loading), :state(pressed).Conformance suite
i18nRoutes 1 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test