← All Components
<mth-csv-importer>
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
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>import '@methane-ui/admin/csv-importer';
import '@methane-ui/react';
export function Example() {
return <mth-csv-importer has-header>Example</mth-csv-importer>;
}<script setup lang="ts">
import '@methane-ui/admin/csv-importer';
</script>
<template>
<mth-csv-importer has-header>Example</mth-csv-importer>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/admin/csv-importer';
import { MthCsvImporterDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthCsvImporterDirective],
template: `<mth-csv-importer has-header>Example</mth-csv-importer>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/admin/csv-importer';
import MthCsvImporter from '@methane-ui/svelte/MthCsvImporter.svelte';
</script>
<MthCsvImporter has-header>Example</MthCsvImporter>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
fields | — | ReadonlyArray<unknown> | — | Target schema fields with required flags and optional row validators. |
rawCsv | raw-csv | string | "" | Raw CSV text payload to parse and map. |
hasHeader | has-header | boolean | true | Whether the first CSV row contains column header names. |
Events
| Event | Detail Type | Description |
|---|---|---|
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
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | delegatesFocus: true with zero host internals.role (ADR-014). | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| states | Exposes ElementInternals CustomStateSet flags: :state(empty), :state(invalid). | Conformance suite |
| i18n | Routes 13 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |