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

<mth-button>

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

Action button with variant, size, form submit/reset, anchor link, and loading states.

When NOT to use: Do not use <mth-button> for navigation links that change the URL; use <mth-link> or a native <a>.

Live Interactive Preview

Interactive StageLive Custom Element · <mth-button> (@methane-ui/ui)
Continue Action
Ready · interact with <mth-button>, or toggle Theme, Direction (LTR/RTL), or props above.

Live Variants & States Showcase

variant="solid"Solid Action
variant="soft"Soft Action
variant="outline"Outline Action
variant="ghost"Ghost Action
variant="danger"Danger Action
sizes (sm / md / lg)SmallMediumLarge
loadingSaving...
disabledDisabled SolidDisabled Outline

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/button"></script>
<mth-button variant="solid" size="sm">Example</mth-button>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
variantvariant'solid' | 'soft' | 'outline' | 'outlined' | 'ghost' | 'danger'"solid"Visual button emphasis.
sizesize'sm' | 'md' | 'lg'"md"Control size token scale.
typetype'button' | 'submit' | 'reset'"button"Native button behavior inside forms (button, submit, or reset).
disableddisabledbooleanfalseDisables interaction.
loadingloadingbooleanfalseShows loading spinner and suppresses duplicate clicks.
hrefhrefstring""Optional safe navigation URL rendering an internal <a> element.
targettargetstring""Browsing context target when href is set.
relrelstring""Relationship attribute when href is set (automatically includes noopener noreferrer for _blank).
namenamestring""Form field name submitted when activated as a submit button.
valuevaluestring""Form field value submitted when activated as a submit button.

Events

EventDetail TypeDescription
mth-press{ originalEvent: Event }Fired when activated via pointer or keyboard while neither disabled nor loading.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
EnterbothButton or link is focused and neither disabled nor loadingActivates the control and emits mth-press
bothButton is focused and neither disabled nor loadingActivates the button and emits mth-press

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-button.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(disabled), :state(loading).Conformance suite
i18nRoutes 1 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test