Component

File Upload Input

File upload components with drag-drop, preview, and progress states

  • Component
  • Tailwind
  • MIT

Preview

Live component

Interactive preview
Open preview
9:41 100%
devsnips.dev/library/tailwind/components/input/file-upload/
fluid · no fixed width 100%
No dependencies Production-ready

Install

Add to your project

terminal
npx devsnips add Tailwind/Components/Input/file-upload
registry path: Tailwind/Components/Input/file-upload

Source

Implementation

code.html
<!-- File Upload - Dashed Border -->
<div class="p-6 border-2 border-dashed border-gray-300 rounded-xl text-center hover:border-blue-400 hover:bg-blue-50/50 transition-colors cursor-pointer">
  <input type="file" class="hidden" />
  <svg class="w-10 h-10 mx-auto text-gray-400 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" />
  </svg>
  <p class="text-sm text-gray-600">Drag and drop files here, or <span class="text-blue-600 font-medium">browse</span></p>
  <p class="text-xs text-gray-400 mt-1">Maximum file size: 10MB</p>
</div>

<!-- File Upload - With Preview -->
<div class="mt-4 p-4 border border-gray-200 rounded-xl">
  <div class="flex items-center gap-4">
    <div class="w-16 h-16 bg-blue-100 rounded-lg flex items-center justify-center">
      <svg class="w-8 h-8 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" />
      </svg>
    </div>
    <div class="flex-1">
      <p class="text-sm font-medium text-gray-900">project-preview.jpg</p>
      <p class="text-xs text-gray-500">2.4 MB • Uploaded just now</p>
    </div>
    <button class="p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors">
      <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
      </svg>
    </button>
  </div>
</div>

<!-- File Upload - Button Style -->
<div class="mt-4">
  <label class="block text-sm font-medium text-gray-700 mb-2">Upload Document</label>
  <div class="flex items-center gap-4">
    <label class="px-6 py-3 bg-blue-600 text-white font-medium rounded-lg hover:bg-blue-700 cursor-pointer transition-colors">
      <span>Choose File</span>
      <input type="file" class="hidden" />
    </label>
    <span class="text-sm text-gray-500">No file chosen</span>
  </div>
</div>
41 lines UTF-8 · LF · Spaces: 2

AI-ready

Available to your agent.

This component is reachable through the DevSnips CLI, MCP server and Skills integrations — one registry, one resource path.

Resource path

devsnips://components/input/file-upload

Continue browsing

View all