Category Chip Nav
A row of category chips (buttons or links) with a result count and an optional sort select.
npx shadcn@latest add https://ui.develop-better-solutions.com/r/category-chip-nav.jsonUses:select
24 products
Sort by
Usage
category-chip-nav-example.tsx
"use client";
import { useState } from "react";
import { CategoryChipNav } from "@dbs/ui";
const SORTS = [
{ value: "featured", label: "Featured" },
{ value: "price-asc", label: "Price: low to high" },
{ value: "price-desc", label: "Price: high to low" },
{ value: "name", label: "Name: A to Z" },
];
export default function CategoryChipNavExample() {
const [cat, setCat] = useState("all");
const [sort, setSort] = useState("featured");
return (
<div className="w-full max-w-3xl rounded-2xl border border-line p-6">
<CategoryChipNav
active={cat}
onSelect={setCat}
categories={[
{ id: "all", label: "All", count: 24 },
{ id: "outerwear", label: "Outerwear", count: 7 },
{ id: "knitwear", label: "Knitwear", count: 9 },
{ id: "accessories", label: "Accessories", count: 8 },
]}
resultLabel="24 products"
sort={{ value: sort, options: SORTS, onChange: setSort, label: "Sort by" }}
/>
</div>
);
}