Skip to content
v0.9.1
Forms

File upload

A drop zone for files: drag them in or click to pick. Files go into the real file input, so a normal form sends them, and show up in a list with their type, size and progress.

Drop zone

A <label class="dropzone" data-momo-dropzone> around a (visually hidden) <input type="file">, followed by a .file-list. accept, multiple and data-max-size (MB) are checked; files that don't fit show an error row. Try dropping a file here; this demo pretends to upload it.

  • Brief.pdf Uploaded · 240 KB
<label class="dropzone" data-momo-dropzone data-max-size="10" data-list="#demo-files" id="demo-drop">
  <input class="visually-hidden" type="file" multiple accept="image/*,.pdf,.csv,.xlsx,.zip">
  <span class="dropzone-art"><i class="mi mi-cloud-upload"></i></span>
  <b>Drop files here or click to browse</b>
  <span class="dropzone-hint">Images, PDF, spreadsheets or zip · up to 10 MB each</span>
</label>
<ul class="file-list" id="demo-files">
  <li class="file-item is-done" data-momo-dismissable><span class="file-icon bg-red" aria-hidden="true"><i class="mi mi-file-text"></i></span><span class="file-name">Brief.pdf</span><span class="file-meta"><i class="mi mi-circle-check"></i> Uploaded · 240 KB</span><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Remove Brief.pdf" data-momo-dismiss><i class="mi mi-x"></i></button></li>
</ul>

Small

.dropzone-sm is a single row, for forms and chat.

    <label class="dropzone dropzone-sm" data-momo-dropzone>
      <input class="visually-hidden" type="file" accept="image/*">
      <span class="dropzone-art"><i class="mi mi-image-plus"></i></span>
      <span><b>Upload a profile photo</b><span class="dropzone-hint">PNG or JPG, square works best</span></span>
    </label>
    <ul class="file-list"></ul>

    File rows

    Write .file-item rows yourself for files already on the server: .is-done turns the line green, .is-error red.

    • Q3_Sales_Report.xlsx64%64%
    • Homepage.png Uploaded · 1.2 MB
    • Launch-video.movToo big: 240 MB (max 10 MB)
    <ul class="file-list">
      <li class="file-item"><span class="file-icon bg-green" aria-hidden="true"><i class="mi mi-sheet"></i></span><span class="file-name">Q3_Sales_Report.xlsx</span><span class="file-meta"><progress class="progress progress-thin" value="64" max="100" aria-label="Uploading Q3_Sales_Report.xlsx">64%</progress><span>64%</span></span><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Cancel"><i class="mi mi-x"></i></button></li>
      <li class="file-item is-done"><span class="file-icon bg-pink" aria-hidden="true"><i class="mi mi-image"></i></span><span class="file-name">Homepage.png</span><span class="file-meta"><i class="mi mi-circle-check"></i> Uploaded · 1.2 MB</span><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Remove"><i class="mi mi-x"></i></button></li>
      <li class="file-item is-error"><span class="file-icon bg-gray" aria-hidden="true"><i class="mi mi-film"></i></span><span class="file-name">Launch-video.mov</span><span class="file-meta">Too big: 240 MB (max 10 MB)</span><button class="btn btn-icon btn-sm btn-ghost" type="button" aria-label="Remove"><i class="mi mi-x"></i></button></li>
    </ul>

    Plain file input

    .file-input styles the browser's own file input.

    <div class="form-field">
      <label class="form-label" for="up-plain">Attachment</label>
      <input class="file-input" id="up-plain" type="file">
    </div>

    JavaScript

    zone.addEventListener('momo:files', async (e) => {
      for (const li of list.querySelectorAll('.file-item:not(.is-error):not(.is-done)')) {
        await upload(li.momoFile, (pct) => Momo.upload.progress(li, pct));
        Momo.upload.done(li);                // or Momo.upload.fail(li, 'Server said no')
      }
    });

    Start

    OverviewStart Getting startedStart CustomizeStart

    Guides

    AccessibilityGuides BreakpointsGuides ChangelogGuides Customize componentsGuides JavaScriptGuides MotionGuides OptimizeGuides PhonesGuides RebootGuides Right-to-left (RTL)Guides Stacking orderGuides Using Momo with AIGuides

    Foundations

    ColorsFoundations TypographyFoundations ProseFoundations Images & figuresFoundations CodeFoundations Lines & shadowsFoundations Dark modeFoundations

    Forms

    Checkbox & switchForms ComboboxForms Date pickerForms Date rangeForms Fields & labelsForms File uploadForms Floating labelsForms Number stepperForms PasswordForms PIN codeForms RatingForms SelectForms SliderForms Tag inputForms Time pickerForms ValidationForms

    Components

    AccordionComponents Alert & bannerComponents AvatarComponents BadgeComponents BreadcrumbComponents ButtonComponents Button groupComponents CalendarComponents CardComponents CarouselComponents ChartsComponents ChipsComponents CollapseComponents Command paletteComponents CommentsComponents Confirm dialogsComponents Cookie bannerComponents Data tableComponents Description listComponents Dialog & toastComponents DividerComponents DrawerComponents Dropdown menuComponents Empty stateComponents File managerComponents Filter & sortComponents Gallery & lightboxComponents Inbox & chatComponents Infinite scrollComponents KanbanComponents Keyboard shortcutsComponents List groupComponents MarqueeComponents Media objectComponents Nav overflowComponents Notification centerComponents PaginationComponents ProgressComponents Pull to refreshComponents SkeletonComponents SortableComponents SpinnerComponents Split viewComponents Stat cardComponents Steps & wizardComponents Swipe actionsComponents TableComponents TabsComponents TimelineComponents TogglerComponents Tooltip & popoverComponents TourComponents Tree viewComponents VideoComponents WhiteboardComponents

    Layout

    Announcement barLayout App shellLayout Back to topLayout Container & sectionLayout ExamplesLayout FooterLayout HeroLayout JumbotronLayout Mega menuLayout NavbarLayout Site sidebarLayout

    Sections

    Bento gridSections Blog cardsSections Call to actionSections Contact & newsletterSections FAQSections FeaturesSections Logo cloudSections PricingSections TeamSections TestimonialsSections

    Utilities

    OverviewUtilities State variantsUtilities Display & flexUtilities Grid & gapUtilities SpacingUtilities SizingUtilities TextUtilities Links & color strengthUtilities Position & overflowUtilities BackgroundsUtilities Borders & effectsUtilities Transforms & filtersUtilities InteractionsUtilities

    Helpers

    Fixed, sticky & frostedHelpers Hover & focusHelpers Hover revealHelpers Icon linkHelpers PrintHelpers Relative timeHelpers Screen reader textHelpers Scroll inHelpers ScrollspyHelpers Share buttonHelpers Skip linkHelpers StacksHelpers Stretched linkHelpers Theme toggleHelpers Truncated textHelpers

    Page patterns

    404 pagePage patterns Coming soonPage patterns Login & registerPage patterns SettingsPage patterns ProfilePage patterns CRM contactsPage patterns ProjectsPage patterns File manager pagePage patterns Billing & plansPage patterns Help centerPage patterns Mobile app screensPage patterns
    ↑ ↓ moveEnter openEsc close