Media and files
Dropzone compact
A single row dropzone for tight forms, here for one PDF up to 2 MB. It needs monsoon.js.
Needs monsoon.js. The styles work on their own, and the behavior comes from the optional interactive layer: add <script src="https://cdn.jsdelivr.net/npm/monsooncss/dist/monsoon.js" defer></script> or import 'monsooncss/js'. See the interactive layer.
Example
<div class="dropzone dropzone-compact max-w-md" data-m-dropzone data-m-dropzone-max-size="2mb"><label class="dropzone-area"><input type="file" name="invoice" accept=".pdf,application/pdf"><span class="dropzone-glyph"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 16V4M7 9l5-5 5 5M4 16v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3"/></svg></span><span class="grid gap-1"><span class="dropzone-title">Upload the invoice</span><span class="dropzone-hint">One PDF, 2 MB at most</span></span></label></div>JavaScript API
Attribute
Add dropzone-compact next to dropzone. Same options, methods and events as the dropzone.
Classes
1 classes. Click a name to copy it. Utilities on the same element always win over component defaults, so any of them can be adjusted with plain utility classes.
| Class | Type | What it does |
|---|---|---|
| Base | Base class of the dropzone compact. On a <div> in the example. Sets alignment, gap, height, padding, text style and width.CSS |
Usage
The styles ship inside the same stylesheet as the utilities, and the behavior comes from the optional monsoon.js script, which enhances any element with a matching data-m attribute, including markup added later.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/monsooncss">
<script src="https://cdn.jsdelivr.net/npm/monsooncss/dist/monsoon.js" defer></script>
<!-- Dropzone compact: start from the base class, then add modifiers -->
<div class="dropzone dropzone-compact max-w-md" data-m-dropzone data-m-dropzone-max-size="2mb"><label class="dropzone-area"><input type="file" name="invoice" accept=".pdf,application/pdf"><span class="dropzone-glyph"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 16V4M7 9l5-5 5 5M4 16v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3"/></svg></span><span class="grid gap-1"><span class="dropzone-title">Upload the invoice</span><span class="dropzone-hint">One PDF, 2 MB at most</span></span></label></div>Theme it with --seed on any ancestor, for example style="--seed: #0d9488", and force a scheme with class="dark" or class="light" on a wrapper.
Accessibility
- Give every control a visible
labellinked withfor, or anaria-labelwhen the purpose is obvious from context. Link help and error text witharia-describedby; invalid styles use:user-invalid, so they appear only after the user interacts. - Every interactive part shows a visible focus ring with
:focus-visible, and tone colors pair with-foregroundtokens that keep text at 4.5:1 or better in light and dark mode.