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

<mth-query-builder>

@methane-ui/admin~7.9 KB brotli (kit + Lit)~2.0 KB marginal

Form-associated nested boolean query builder (<mth-query-builder>) with JSON/SQL-style preview and FormControlController validation.

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

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/admin/query-builder"></script>
<mth-query-builder value="{&quot;combinator&quot;:&quot;and&quot;,&quot;items&quot;:[]}" show-preview></mth-query-builder>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
namenamestring""Form field name for FormData submission.
valuevaluestring"{\"combinator\":\"and\",\"items\":[]}"Serialized JSON string of the query AST.
fields—ReadonlyArray<unknown>—Available field definitions.
showPreviewshow-previewbooleantrueDisplays serialized JSON query preview.
disableddisabledbooleanfalseDisables all query controls.
requiredrequiredbooleanfalseRequires at least one leaf rule.
readonlyreadonlybooleanfalsePrevents edits while allowing inspection.
errorerrorstring""Explicit error message.

Events

EventDetail TypeDescription
mth-change{ value: string; query: unknown }Emitted when the nested query structure changes.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
Enterbothfocus is on group/rule controlsadds or updates query structure

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