Workflow: Search & Filter Products

Search for products, filter by category and price, and switch between layouts.

Search & Filter Controls

Refine your product search

1// Search and filter implementation
2const [searchQuery, setSearchQuery] = useState('');
3const [category, setCategory] = useState<string | null>(null);
4const [priceRange, setPriceRange] = useState('all');
5
6const filteredProducts = products
7 .filter(p => p.name.includes(searchQuery))
8 .filter(p => !category || p.categoryId === category)
9 .filter(p => filterByPrice(p, priceRange));

Results (8)

Classic Band Tee

Classic Band Tee

€ 29,99

Limited Edition Tour Tee

Limited Edition Tour Tee

€ 34,99

Premium Logo Hoodie

Premium Logo Hoodie

€ 59,99

Embroidered Dad Hat

Embroidered Dad Hat

€ 24,99

Canvas Tote Bag

Canvas Tote Bag

€ 19,99

Latest Album - Limited Vinyl

Latest Album - Limited Vinyl

€ 39,99

Concert Poster - Signed

Concert Poster - Signed

€ 29,99

Vintage Festival Tee - SOLD OUT

Vintage Festival Tee - SOLD OUT

€ 29,99

1// Display filtered results
2<ProductGallery
3 products={filteredProducts}
4 layout={layout}
5 emptyState={
6 <EmptyState
7 title="No products found"
8 description="Try adjusting your filters"
9 action={<Button onClick={clearFilters}>Clear Filters</Button>}
10 />
11 }
12/>