In this tutorial we will create Image upload and file upload, attach file upload, responsive file upload, examples with Tailwind CSS
Setup Project
Using CDN
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
or
The Easiest way to install Tailwind CSS with Tailwind CLI
How to Install Tailwind CSS with NPM
Example 1
Image File Upload .
<div class="flex justify-center mt-8">
<div class="rounded-lg shadow-xl bg-gray-50 lg:w-1/2">
<div class="m-4">
<label class="inline-block mb-2 text-gray-500">Upload
Image(jpg,png,svg,jpeg)</label>
<div class="flex items-center justify-center w-full">
<label class="flex flex-col w-full h-32 border-4 border-dashed hover:bg-gray-100 hover:border-gray-300">
<div class="flex flex-col items-center justify-center pt-7">
<svg xmlns="http://www.w3.org/2000/svg"
class="w-12 h-12 text-gray-400 group-hover:text-gray-600" viewBox="0 0 20 20"
fill="currentColor">
<path fill-rule="evenodd"
d="M4 3a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V5a2 2 0 00-2-2H4zm12 12H4l4-8 3 6 2-4 3 6z"
clip-rule="evenodd" />
</svg>
<p class="pt-1 text-sm tracking-wider text-gray-400 group-hover:text-gray-600">
Select a photo</p>
</div>
<input type="file" class="opacity-0" />
</label>
</div>
</div>
<div class="flex p-2 space-x-4">
<button class="px-4 py-2 text-white bg-red-500 rounded shadow-xl">Cannel</button>
<button class="px-4 py-2 text-white bg-green-500 rounded shadow-xl">Create</button>
</div>
</div>
</div>
Example 2
Attach File Upload.
<div class="flex justify-center mt-8">
<div class="max-w-2xl rounded-lg shadow-xl bg-gray-50">
<div class="m-4">
<label class="inline-block mb-2 text-gray-500">File Upload</label>
<div class="flex items-center justify-center w-full">
<label
class="flex flex-col w-full h-32 border-4 border-blue-200 border-dashed hover:bg-gray-100 hover:border-gray-300">
<div class="flex flex-col items-center justify-center pt-7">
<svg xmlns="http://www.w3.org/2000/svg" class="w-8 h-8 text-gray-400 group-hover:text-gray-600"
fill="none" viewBox="0 0 24 24" stroke="currentColor">
<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="pt-1 text-sm tracking-wider text-gray-400 group-hover:text-gray-600">
Attach a file</p>
</div>
<input type="file" class="opacity-0" />
</label>
</div>
</div>
<div class="flex justify-center p-2">
<button class="w-full px-4 py-2 text-white bg-blue-500 rounded shadow-xl">Create</button>
</div>
</div>
</div>
See Also
Tailwind CSS Free Digital Agency Landing Page
TailFood – Free Tailwind CSS Restaurant Template
Tailwind CSS Real Estate Template
Tailwind CSS Simple Responsive Landing Page Template
Tailwind CSS Simple Verification Email Template
Read Also
Tailwind CSS 3 FAQ Accordion UI Example
Tailwind CSS 3 Alert Message Example
Tailwind CSS 3 Avatars Example
Tailwind CSS 3 Breadcrumb Example
Tailwind CSS Gradient Button Example
Tailwind CSS 3D Button Example
Tailwind CSS Loading Button Example
Tailwind CSS v3 Cards Examples
Tailwind CSS Checkbox Form Examples
Tailwind CSS Dropdowns (Menu) on Hover Example
Tailwind CSS Multiselect Dropdown Example
How to use dark mode toggle switch in Tailwind CSS 3
How to use @apply directive in Tailwind CSS
Tailwind CSS sticky header & fixed navbar example
Tailwind CSS Navbar UI Example
Tailwind CSS 3 Login Page UI Example
Tailwind CSS Login Modal Example
Tailwind CSS 3 Overlay Image Example
Tailwind CSS Thank You Page Example
Tailwind CSS Timeline UI Example
Tailwind CSS Responsive Footer Section Example
Tailwind CSS Background Image Header Example