← All Components
<mth-dropzone>
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
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>import '@methane-ui/ui/dropzone';
import '@methane-ui/react';
export function Example() {
return <mth-dropzone multiple max-file-size="0">Example</mth-dropzone>;
}<script setup lang="ts">
import '@methane-ui/ui/dropzone';
</script>
<template>
<mth-dropzone multiple max-file-size="0">Example</mth-dropzone>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/dropzone';
import { MthDropzoneDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthDropzoneDirective],
template: `<mth-dropzone multiple max-file-size="0">Example</mth-dropzone>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/dropzone';
import MthDropzone from '@methane-ui/svelte/MthDropzone.svelte';
</script>
<MthDropzone multiple max-file-size="0">Example</MthDropzone>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
accept | accept | string | "" | Advisory comma-separated MIME types or extensions. |
multiple | multiple | boolean | true | Allows dropping or selecting multiple files. |
maxFileSize | max-file-size | number | 0 | Advisory maximum size in bytes per file (0 disables limit). |
maxFiles | max-files | number | 0 | Advisory maximum number of files per drop (0 disables limit). |
disabled | disabled | boolean | false | Disables drag-and-drop and dialog interaction. |
label | label | string | "" | Accessible region label. |
Events
| Event | Detail Type | Description |
|---|---|---|
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
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | Dropzone trigger button is focused | Opens the native file chooser dialog |
| Space | both | Dropzone trigger button is focused | Opens the native file chooser dialog |
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 |
| keyboard | Implements all 2 APG keyboard transitions across LTR/RTL. | mth-dropzone.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(disabled), :state(dragover). | Conformance suite |
| i18n | Routes 2 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |