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

<mth-badge>

@methane-ui/ui~6.8 KB brotli (cold + Lit)~1.4 KB marginal

Compact status, count, or category indicator badge with variant, size, pill, and dot modes.

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

Live Variants & States Showcase

neutral / accent / successNeutralAccentSuccess
warning / dangerWarningDanger
pill & dotv2.0OnlineAlert
sizes (sm / md / lg)SMMDLG

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/badge"></script>
<mth-badge variant="neutral" size="sm">Example</mth-badge>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
variantvariant'neutral' | 'accent' | 'success' | 'warning' | 'danger'"neutral"Semantic color variant (neutral | accent | success | warning | danger).
sizesize'sm' | 'md' | 'lg'"md"Visual badge size scale (sm | md | lg).
pillpillbooleanfalseApplies fully rounded pill corners.
dotdotbooleanfalseRenders as a compact status dot indicator without text.

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="none".lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
statesExposes ElementInternals CustomStateSet flags: :state(pill), :state(dot).Conformance suite