← All Components
<mth-button>
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
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)Small Medium Large
loadingSaving...
disabledDisabled Solid Disabled Outline
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/button"></script>
<mth-button variant="solid" size="sm">Example</mth-button>import '@methane-ui/ui/button';
import '@methane-ui/react';
export function Example() {
return <mth-button variant="solid" size="sm">Example</mth-button>;
}<script setup lang="ts">
import '@methane-ui/ui/button';
</script>
<template>
<mth-button variant="solid" size="sm">Example</mth-button>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/button';
import { MthButtonDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthButtonDirective],
template: `<mth-button variant="solid" size="sm">Example</mth-button>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/button';
import MthButton from '@methane-ui/svelte/MthButton.svelte';
</script>
<MthButton variant="solid" size="sm">Example</MthButton>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
variant | variant | 'solid' | 'soft' | 'outline' | 'outlined' | 'ghost' | 'danger' | "solid" | Visual button emphasis. |
size | size | 'sm' | 'md' | 'lg' | "md" | Control size token scale. |
type | type | 'button' | 'submit' | 'reset' | "button" | Native button behavior inside forms (button, submit, or reset). |
disabled | disabled | boolean | false | Disables interaction. |
loading | loading | boolean | false | Shows loading spinner and suppresses duplicate clicks. |
href | href | string | "" | Optional safe navigation URL rendering an internal <a> element. |
target | target | string | "" | Browsing context target when href is set. |
rel | rel | string | "" | Relationship attribute when href is set (automatically includes noopener noreferrer for _blank). |
name | name | string | "" | Form field name submitted when activated as a submit button. |
value | value | string | "" | Form field value submitted when activated as a submit button. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-press | { originalEvent: Event } | Fired when activated via pointer or keyboard while neither disabled nor loading. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | Button or link is focused and neither disabled nor loading | Activates the control and emits mth-press |
both | Button is focused and neither disabled nor loading | Activates the button and 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-button.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(disabled), :state(loading). | Conformance suite |
| i18n | Routes 1 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |