Input With Icon
<section class="p-6 bg-white rounded-lg shadow-sm">
<div class="max-w-md mx-auto space-y-6">
<!-- Input with Left Icon -->
<div class="space-y-2">
<label for="email-icon-input" class="block text-sm font-medium text-gray-700">Email Address</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path d="M2.003 5.884L10 9.882l7.997-3.998A2 2 0 0016 4H4a2 2 0 00-1.997 1.884z" />
<path d="M18 8.118l-8 4-8-4V14a2 2 0 002 2h12a2 2 0 002-2V8.118z" />
</svg>
</div>
<input type="email" id="email-icon-input" placeholder="[email protected]"
class="w-full pl-10 pr-4 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
</div>
</div>
<!-- Input with Right Icon -->
<div class="space-y-2">
<label for="search-icon-input" class="block text-sm font-medium text-gray-700">Search</label>
<div class="relative">
<input type="text" id="search-icon-input" placeholder="Search..."
class="w-full pr-10 pl-4 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
<div class="absolute inset-y-0 right-0 pr-3 flex items-center">
<button type="button" class="text-gray-400 hover:text-gray-500 focus:outline-none">
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
</svg>
</button>
</div>
</div>
</div>
<!-- Input with Both Icons -->
<div class="space-y-2">
<label for="password-both-icons" class="block text-sm font-medium text-gray-700">Password</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z" clip-rule="evenodd" />
</svg>
</div>
<input type="password" id="password-both-icons" placeholder="Enter your password"
class="w-full pl-10 pr-10 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
<div class="absolute inset-y-0 right-0 pr-3 flex items-center">
<button type="button" class="text-gray-400 hover:text-gray-500 focus:outline-none">
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path d="M10 12a2 2 0 100-4 2 2 0 000 4z" />
<path fill-rule="evenodd" d="M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z" clip-rule="evenodd" />
</svg>
</button>
</div>
</div>
</div>
<!-- Input with Icon and Button -->
<div class="space-y-2">
<label for="location-input" class="block text-sm font-medium text-gray-700">Location</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z" clip-rule="evenodd" />
</svg>
</div>
<input type="text" id="location-input" placeholder="Enter your location"
class="w-full pl-10 pr-20 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
<div class="absolute inset-y-0 right-0 flex items-center">
<button type="button" class="inline-flex items-center px-4 h-full text-sm text-blue-600 bg-blue-50 border-l border-gray-300 rounded-r-md hover:bg-blue-100 focus:outline-none">
Detect
</button>
</div>
</div>
</div>
</div>
</section>
Copied to clipboard