Adventureland Registry

Filter Section

A sidebar filter panel composing two AccordionFilterGroup instances (Type and Topic). Accepts filter option arrays via props so no seed data is baked in.

FilterSection renders a "/ FILTER" header with a "CLEAR FILTERS" button and two collapsible accordion groups backed by AccordionFilterGroup. Pass your own filterTypes and filterTopics arrays, lift state for openAccordions, and optionally wire onTypeToggle / onTopicToggle callbacks for controlled filtering.

Installation

npx shadcn@latest add @adv/filter-section

Usage

import { FilterSection } from '@/components/sectionAccordion/filter-section';

const filterTypes = [
  { id: 'video', label: 'Video', count: 21 },
  { id: 'blog', label: 'Blog', count: 53 },
];
const filterTopics = [
  { id: 'aws', label: 'AWS', count: 14 },
];

export function Sidebar() {
  const [openAccordions, setOpenAccordions] = useState(['type']);

  return (
    <FilterSection
      filterTypes={filterTypes}
      filterTopics={filterTopics}
      openAccordions={openAccordions}
      setOpenAccordions={setOpenAccordions}
      onClearFilters={() => console.log('cleared')}
    />
  );
}

Example

/ FILTER

Props

PropTypeDefaultDescription
filterTypesFilterOption[]Options for the "Type" accordion group.
filterTopicsFilterOption[]Options for the "Topic" accordion group.
openAccordionsstring[]Controlled list of open accordion values.
setOpenAccordionsDispatch<SetStateAction<string[]>>State setter for openAccordions.
selectedTypesstring[]Selected type filter ids (optional, controlled).
selectedTopicsstring[]Selected topic filter ids (optional, controlled).
onTypeToggle(id: string) => voidCallback when a type checkbox is toggled.
onTopicToggle(id: string) => voidCallback when a topic checkbox is toggled.
onClearFilters() => voidCallback for the "CLEAR FILTERS" button.

On this page