Componente Filtri
Un componente di filtri complesso e reattivo per una dashboard, caratterizzato da un design pulito e minimalista con una combinazione di colori neon/elettrico, che supporta più elementi interattivi e la modalità scura. Progettato per la visualizzazione dei dati e i pannelli di controllo.
Codice HTML
<div class="p-4 sm:p-6 lg:p-8 bg-gray-100 dark:bg-gray-900 min-h-screen font-sans text-gray-800 dark:text-gray-200 transition-colors duration-300">
<div class="max-w-7xl mx-auto">
<h2 class="text-3xl sm:text-4xl font-extrabold mb-8 text-lime-400 dark:text-lime-500 tracking-tight">Dashboard Filters</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
<!-- Search Input -->
<div class="col-span-full md:col-span-2 lg:col-span-1 xl:col-span-2 relative">
<label for="search" class="block text-sm font-medium text-blue-600 dark:text-blue-400 mb-2">Search Anything</label>
<input type="text" id="search" placeholder="Type here to search..." class="w-full px-4 py-3 border border-blue-500 dark:border-blue-600 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-400 dark:focus:ring-blue-500 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 transition-colors duration-300">
<div class="absolute inset-y-0 right-0 pr-3 flex items-center pt-8 pointer-events-none">
<svg class="h-5 w-5 text-blue-500 dark:text-blue-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
</div>
</div>
<!-- Date Range Picker -->
<div class="col-span-full lg:col-span-2 xl:col-span-2 grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label for="startDate" class="block text-sm font-medium text-pink-600 dark:text-pink-400 mb-2">Start Date</label>
<input type="date" id="startDate" class="w-full px-4 py-3 border border-pink-500 dark:border-pink-600 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-pink-400 dark:focus:ring-pink-500 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 transition-colors duration-300">
</div>
<div>
<label for="endDate" class="block text-sm font-medium text-pink-600 dark:text-pink-400 mb-2">End Date</label>
<input type="date" id="endDate" class="w-full px-4 py-3 border border-pink-500 dark:border-pink-600 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-pink-400 dark:focus:ring-pink-500 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 transition-colors duration-300">
</div>
</div>
<!-- Dropdown Filter 1 -->
<div>
<label for="categoryFilter" class="block text-sm font-medium text-lime-600 dark:text-lime-400 mb-2">Category</label>
<div class="relative">
<select id="categoryFilter" class="block appearance-none w-full px-4 py-3 pr-8 border border-lime-500 dark:border-lime-600 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-lime-400 dark:focus:ring-lime-500 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 transition-colors duration-300">
<option value="">All Categories</option>
<option value="finance">Finance</option>
<option value="marketing">Marketing</option>
<option value="operations">Operations</option>
<option value="hr">HR</option>
<option value="sales">Sales</option>
</select>
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-lime-700 dark:text-lime-500">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/></svg>
</div>
</div>
</div>
<!-- Dropdown Filter 2 -->
<div>
<label for="statusFilter" class="block text-sm font-medium text-purple-600 dark:text-purple-400 mb-2">Status</label>
<div class="relative">
<select id="statusFilter" class="block appearance-none w-full px-4 py-3 pr-8 border border-purple-500 dark:border-purple-600 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-purple-400 dark:focus:ring-purple-500 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 transition-colors duration-300">
<option value="">All Statuses</option>
<option value="active">Active</option>
<option value="pending">Pending</option>
<option value="completed">Completed</option>
<option value="cancelled">Cancelled</option>
</select>
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-purple-700 dark:text-purple-500">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/></svg>
</div>
</div>
</div>
<!-- Slider Filter (Range) -->
<div class="col-span-full md:col-span-2 lg:col-span-1 xl:col-span-2">
<label for="rangeFilter" class="block text-sm font-medium text-cyan-600 dark:text-cyan-400 mb-2">Value Range <span id="rangeValue" class="font-bold">$100 - $500</span></label>
<input type="range" id="rangeFilter" min="0" max="1000" value="300" step="100" class="w-full h-2 bg-gradient-to-r from-teal-400 to-cyan-500 dark:from-teal-600 dark:to-cyan-700 rounded-lg appearance-none cursor-pointer focus:outline-none focus:ring-2 focus:ring-cyan-400 dark:focus:ring-cyan-500 transition-colors duration-300">
</div>
<!-- Checkbox Group -->
<fieldset class="col-span-full md:col-span-2 lg:col-span-1 xl:col-span-2 bg-white dark:bg-gray-800 p-4 rounded-lg shadow-sm border border-orange-500 dark:border-orange-600 transition-colors duration-300">
<legend class="text-sm font-medium text-orange-600 dark:text-orange-400 mb-3">Options</legend>
<div class="grid grid-cols-2 gap-y-2 sm:gap-x-4">
<div class="flex items-center">
<input id="option1" type="checkbox" class="h-5 w-5 text-orange-500 dark:text-orange-400 rounded focus:ring-orange-400 dark:focus:ring-orange-500 border-gray-300 dark:border-gray-600 bg-gray-200 dark:bg-gray-700">
<label for="option1" class="ml-2 text-gray-800 dark:text-gray-200">Critical Only</label>
</div>
<div class="flex items-center">
<input id="option2" type="checkbox" class="h-5 w-5 text-orange-500 dark:text-orange-400 rounded focus:ring-orange-400 dark:focus:ring-orange-500 border-gray-300 dark:border-gray-600 bg-gray-200 dark:bg-gray-700">
<label for="option2" class="ml-2 text-gray-800 dark:text-gray-200">Hide Completed</label>
</div>
<div class="flex items-center">
<input id="option3" type="checkbox" class="h-5 w-5 text-orange-500 dark:text-orange-400 rounded focus:ring-orange-400 dark:focus:ring-orange-500 border-gray-300 dark:border-gray-600 bg-gray-200 dark:bg-gray-700">
<label for="option3" class="ml-2 text-gray-800 dark:text-gray-200">Show Drafts</label>
</div>
<div class="flex items-center">
<input id="option4" type="checkbox" class="h-5 w-5 text-orange-500 dark:text-orange-400 rounded focus:ring-orange-400 dark:focus:ring-orange-500 border-gray-300 dark:border-gray-600 bg-gray-200 dark:bg-gray-700">
<label for="option4" class="ml-2 text-gray-800 dark:text-gray-200">Archive Inclusive</label>
</div>
</div>
</fieldset>
<!-- Apply and Reset Buttons -->
<div class="col-span-full flex flex-col sm:flex-row space-y-4 sm:space-y-0 sm:space-x-4 mt-4">
<button class="flex-1 py-3 px-6 rounded-lg font-semibold text-white bg-gradient-to-r from-blue-600 to-indigo-700 hover:from-blue-700 hover:to-indigo-800 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 shadow-md transition-all duration-300 transform hover:scale-105">
<span class="flex items-center justify-center">
<svg class="w-5 h-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
Apply Filters
</span>
</button>
<button class="flex-1 py-3 px-6 rounded-lg font-semibold text-gray-800 dark:text-gray-200 bg-gray-300 dark:bg-gray-700 hover:bg-gray-400 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-400 dark:focus:ring-gray-600 shadow-md transition-all duration-300 transform hover:scale-105 border border-gray-400 dark:border-gray-600">
<span class="flex items-center justify-center">
<svg class="w-5 h-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004 16.08V12m-8.982 8l9-9 9 9M7 12l-2-2m0 0L3 6m2 2l4-4" />
</svg>
Reset
</span>
</button>
</div>
</div>
</div>
<script>
// JavaScript for range slider value display (optional, but good for UX)
document.addEventListener('DOMContentLoaded', function() {
const rangeFilter = document.getElementById('rangeFilter');
const rangeValue = document.getElementById('rangeValue');
if (rangeFilter && rangeValue) {
rangeFilter.addEventListener('input', function() {
const value = parseInt(this.value);
rangeValue.textContent = `$${value} - $${value + 400}`;
});
// Set initial value
const initialValue = parseInt(rangeFilter.value);
rangeValue.textContent = `$${initialValue} - $${initialValue + 400}`;
}
});
</script>
</div>
Componenti correlati
Componente Filtri
Un componente di filtri progettato con uno stile scheumorfico che imita i controlli del mondo reale, utilizzando una combinazione di colori in scala di grigi, perfetta per dashboard con elementi interattivi complessi.
Componente Filtri Glassmorphism
Un componente di filtri in stile Glassmorphism semplice e reattivo per un portafoglio, con elementi traslucidi simili al vetro smerigliato con effetti di sfocatura, colori complementari e supporto per la modalità scura.
Glassmorphism_EarthTones_SocialMedia_Filters
Un componente di filtri per social media complesso e reattivo con un design glassmorphism, una combinazione di colori color terra e un supporto completo per la modalità scura. Presenta elementi traslucidi simili al vetro smerigliato con effetti di sfocatura, HTML semantico e opzioni di filtro interattivo.