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

<mth-dropzone>

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

Accessible drag-and-drop file dropzone with advisory MIME/size checks and keyboard file dialog trigger.

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-dropzone> (@methane-ui/ui)
Drop tokens.json or SVG files here, or click to browse.
Ready · interact with <mth-dropzone>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/dropzone"></script>
<mth-dropzone multiple max-file-size="0">Example</mth-dropzone>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
acceptacceptstring""Advisory comma-separated MIME types or extensions.
multiplemultiplebooleantrueAllows dropping or selecting multiple files.
maxFileSizemax-file-sizenumber0Advisory maximum size in bytes per file (0 disables limit).
maxFilesmax-filesnumber0Advisory maximum number of files per drop (0 disables limit).
disableddisabledbooleanfalseDisables drag-and-drop and dialog interaction.
labellabelstring""Accessible region label.

Events

EventDetail TypeDescription
mth-drop{ files: File[] }Fired with accepted files when files are dropped or chosen.
mth-reject{ rejected: Array<{ file: File; reason: string }> }Fired when files fail advisory checks.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
EnterbothDropzone trigger button is focusedOpens the native file chooser dialog
SpacebothDropzone trigger button is focusedOpens the native file chooser dialog

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-dropzone.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(disabled), :state(dragover).Conformance suite
i18nRoutes 2 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test