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

<mth-json-editor>

@methane-ui/code~9.0 KB brotli shell + lazy engine~2.6 KB shell · lazy engine chunk

Form-associated CodeMirror 6 JSON editor with live JSON syntax validation, prettify formatting, collapsible interactive tree view, and --mth-* token synchronization.

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

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/code/json-editor"></script>
<mth-json-editor mode="code"></mth-json-editor>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
namenamestring""name property.
labellabelstring""label property.
valuevaluestring""value property.
modemode'code' | 'tree' | 'split'"code"mode property.
requiredrequiredbooleanfalserequired property.
disableddisabledbooleanfalsedisabled property.
readonlyreadonlybooleanfalsereadonly property.

Events

EventDetail TypeDescription
mth-input{ value: string; valid: boolean }Emitted event mth-input.
mth-change{ value: string; valid: boolean }Emitted event mth-change.
mth-mode-change{ mode: unknown }Emitted event mth-mode-change.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowRightltrtoolbar button focusedmoves focus to next control
ArrowLeftrtltoolbar button focusedmoves focus to next control

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-json-editor.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(disabled), :state(readonly), :state(invalid), :state(dirty), :state(touched), :state(focused), :state(split).Conformance suite
i18nRoutes 10 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test