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

<mth-csv-importer>

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

CSV file upload and paste importer (<mth-csv-importer>) with RFC-4180 parsing, interactive column-to-field mapping, row validation preview, and mth-import commit event.

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

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/admin/csv-importer"></script>
<mth-csv-importer has-header>Example</mth-csv-importer>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
fields—ReadonlyArray<unknown>—Target schema fields with required flags and optional row validators.
rawCsvraw-csvstring""Raw CSV text payload to parse and map.
hasHeaderhas-headerbooleantrueWhether the first CSV row contains column header names.

Events

EventDetail TypeDescription
mth-parse{ headers: ReadonlyArray<string>; rowCount: number }Emitted after parsing CSV headers and rows.
mth-import{ rows: ReadonlyArray<Record<string, string>>; invalidCount: number; mappings: Record<number, string> }Emitted when validated mapped rows are committed for import.

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
statesExposes ElementInternals CustomStateSet flags: :state(empty), :state(invalid).Conformance suite
i18nRoutes 13 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test