1. Overview
This single-file HTML application demonstrates a modern product listing interface with advanced client-side filtering. It features a price range slider, multi-select product categories, availability filters, and multiple sorting options. The interface is fully responsive and includes a mobile-friendly modal filter system.
2. Architecture
The application is built as a self-contained HTML document using:
- HTML5 for structure
- Bootstrap 5.3 for responsive grid and components
- Vanilla JavaScript (ES6+) for all interactivity
- CSS3 with custom styling and Google Fonts
3. Data Structure
Product data is stored in a JavaScript array of objects:
const products = [
{
id: 1,
name: "NovaFlow",
type: "saas",
price: 89,
availability: "active",
img: "https://picsum.photos/..."
},
// ... more products
];
4. Main Components
4.1 Sidebar Filters (Desktop)
The left sidebar contains three main filter groups:
- Maximum Price: Range slider (10–800) with live value display
- Product Type: Multi-select checkboxes (SaaS, API, DevTools)
- Availability: Radio buttons (All, Active Subscription, Free Trial)
4.2 Products Grid
A responsive Bootstrap grid (row-cols-1 row-cols-sm-2 row-cols-md-4) that renders product cards with:
- High-quality images (object-fit: cover)
- Product name and price
- Hover animations (lift + shadow)
4.3 Sorting Controls
Three sorting options using custom radio buttons with icons:
- Relevance (default)
- Price: Low to High
- Price: High to Low
5. Core JavaScript Functions
5.1 filterAndSortProducts()
The main filtering engine. It:
- Reads current filter states from the DOM
- Applies price, type, and availability filters
- Sorts results according to user selection
- Calls
renderProducts()
5.2 renderProducts(filtered)
Dynamically generates product cards using template literals and updates the results counter.
5.3 Event Handling
- Live filtering on any input change (
filterForm.addEventListener('change')) - Real-time price slider updates
- Sorting radio button listeners
- Clear filters functionality
6. Mobile Experience
The interface includes a dedicated mobile modal triggered by a "Filters" button (visible only on d-md-none). When the user applies filters in the modal, values are synchronized back to the main form before re-rendering.
7. Key Features
Real-time Updates
All filters update the product grid instantly without page reload.
Responsive Design
Optimized for desktop, tablet, and mobile with Bootstrap breakpoints.
Clean State Management
Form reset and value synchronization between desktop and mobile views.
Smooth UX
CSS transitions, hover effects, and intuitive controls.
8. Extensibility
This codebase can be easily extended by:
- Adding more filter categories (brands, ratings, etc.)
- Connecting to a real backend API instead of the static array
- Implementing pagination for larger datasets
- Adding localStorage persistence for user preferences
- Enhancing accessibility with ARIA labels
Technical documentation generated for the product filtering interface.
Built with vanilla JavaScript and Bootstrap 5.