← All Components
<mth-split-button>
Split action button pairing a primary button with an anchored secondary options menu.
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-split-button>, or toggle Theme, Direction (LTR/RTL), or props above.
Live Variants & States Showcase
variant="solid"
variant="outline"
variant="ghost"
disabled
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/split-button"></script>
<mth-split-button variant="solid" size="sm">Example</mth-split-button>import '@methane-ui/ui/split-button';
import '@methane-ui/react';
export function Example() {
return <mth-split-button variant="solid" size="sm">Example</mth-split-button>;
}<script setup lang="ts">
import '@methane-ui/ui/split-button';
</script>
<template>
<mth-split-button variant="solid" size="sm">Example</mth-split-button>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/split-button';
import { MthSplitButtonDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthSplitButtonDirective],
template: `<mth-split-button variant="solid" size="sm">Example</mth-split-button>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/split-button';
import MthSplitButton from '@methane-ui/svelte/MthSplitButton.svelte';
</script>
<MthSplitButton variant="solid" size="sm">Example</MthSplitButton>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
label | label | string | "" | Optional primary button label when no slotted children are supplied. |
variant | variant | 'solid' | 'outline' | 'ghost' | "solid" | Visual button style (solid, outline, or ghost). |
size | size | 'sm' | 'md' | 'lg' | "md" | Control size scale (sm, md, or lg). |
disabled | disabled | boolean | false | Disables both primary and menu trigger buttons. |
open | open | boolean | false | Controls visibility of the secondary dropdown menu. |
menuLabel | menu-label | string | "" | Accessible aria-label for the dropdown toggle button. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-press | { originalEvent: Event } | Fired when the primary action button is pressed. |
mth-select | { value: string; label: string } | Fired when a secondary menu option is chosen. |
mth-open | { open: true } | Cancelable event fired before opening the menu. |
mth-after-open | { open: true } | Fired after open transition completes. |
mth-close | { reason: string } | Fired when the menu closes. |
mth-after-close | { reason: string } | Fired after close transition and focus restore complete. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowDown | both | Secondary trigger is focused | Opens menu and focuses first enabled item |
| Escape | both | Secondary menu is open | Closes menu and restores focus to trigger |
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-split-button.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(open), :state(disabled). | Conformance suite |
| i18n | Routes 1 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |