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

<mth-button-group>

@methane-ui/ui~9.0 KB brotli (cold + Lit)~2.6 KB marginal

Groups related buttons or icon buttons with optional attached styling and toolbar roving focus.

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-button-group> (@methane-ui/ui)
StartCenterEnd
Ready · interact with <mth-button-group>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/button-group"></script>
<mth-button-group orientation="horizontal" role-mode="group">Example</mth-button-group>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
orientationorientation'horizontal' | 'vertical'"horizontal"Layout and arrow-key navigation axis (horizontal or vertical).
attachedattachedbooleanfalseVisually joins adjacent buttons along the group axis.
rovingrovingbooleanfalseEnables single-tabstop APG roving focus navigation across slotted buttons.
roleModerole-mode'group' | 'toolbar'"group"Semantic host role (group or toolbar). Setting toolbar automatically enables roving focus.
labellabelstring""Accessible aria-label exposed via ElementInternals.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowRightltrHorizontal roving/toolbar mode is activeMoves focus to the next enabled button
ArrowLeftrtlHorizontal roving/toolbar mode is active in RTLMoves focus to the next enabled button
ArrowDownbothVertical roving/toolbar mode is activeMoves focus to the next enabled button
ArrowUpbothVertical roving/toolbar mode is activeMoves focus to the previous enabled button
HomebothRoving/toolbar mode is activeMoves focus to the first enabled button
EndbothRoving/toolbar mode is activeMoves focus to the last enabled button

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="none" with host role="group".lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 6 APG keyboard transitions across LTR/RTL.mth-button-group.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(attached), :state(vertical), :state(roving).Conformance suite