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

<mth-segmented-control>

@methane-ui/ui~11.2 KB brotli (cold + Lit)~3.8 KB marginal

Form-associated single-select segmented control with animated RTL-safe active indicator pill, roving focus, and slotted or options-driven items.

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

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/segmented-control"></script>
<mth-segmented-control size="sm">Example</mth-segmented-control>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
namenamestring""Form field name.
valuevaluestring""Selected segment value.
defaultValuedefault-valuestring""Initial value restored on form reset.
labellabelstring""Group label.
hinthintstring""Helper message.
errorerrorstring""Validation error message.
sizesize'sm' | 'md' | 'lg'"md"Control size variant.
fullWidthfull-widthbooleanfalseExpands control to full container width.
disableddisabledbooleanfalseDisables the segmented control.
requiredrequiredbooleanfalseMarks selection required.
options—ReadonlyArray<unknown> | nullnullProgrammatic array of segmented options.

Events

EventDetail TypeDescription
mth-change{ value: string }Dispatched when the user selects a segment.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowRightltrsegment focusedmoves focus to next segment
ArrowLeftrtlsegment focusedmoves focus to next segment in RTL
Home / Endbothsegment focusedmoves focus to first or last enabled segment
Enter / Spacebothsegment focusedselects the focused segment

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 4 APG keyboard transitions across LTR/RTL.mth-segmented-control.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(dirty), :state(touched), :state(user-invalid), :state(disabled), :state(required).Conformance suite
i18nRoutes 2 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test