Skip to main content
Our new developer certification is live!

SearchSidebar

Filter sidebar component for search with content type, subjects, technology, and person filters. Collapsible sections; Content Type open by default, others closed but expand when URL has active filters.

Props

PropTypeRequiredDefaultDescription
searchQuerystringYes-Current search query value
onSearchQueryChange(value: string) => voidYes-Callback when search input changes
onSearchSubmit(event: FormEvent) => voidYes-Callback when search form is submitted
onSearchClear() => voidYes-Callback when search is cleared
contentTypesFilterOption[]Yes-Content type filter options
subjectsFilterOption[]Yes-Subject filter options
technologyFilterOption[]Yes-Technology filter options (with optional icons)
authorsFilterOption[]Yes-Person filter options
selectedContentTypesstring[]Yes-Currently selected content type values
selectedSubjectsstring[]Yes-Currently selected subject term_uids
selectedTechnologystring[]Yes-Currently selected technology term_uids
selectedAuthorsstring[]Yes-Currently selected author UIDs
onContentTypeChange(value: string, checked: boolean) => voidYes-Callback when content type filter changes
onSubjectChange(value: string, checked: boolean) => voidYes-Callback when subject filter changes
onTechnologyChange(value: string, checked: boolean) => voidYes-Callback when technology filter changes
onAuthorChange(value: string, checked: boolean) => voidYes-Callback when person filter changes

FilterOption Type

interface FilterOption {
  value: string;
  label: string;
  count: number;
  iconSrc?: string;  // Optional icon path (e.g. /technologies/react.svg) for technology filter
}

Usage

import SearchSidebar from '@/components/molecules/SearchSidebar';

<SearchSidebar
  searchQuery={searchInput}
  onSearchQueryChange={setSearchInput}
  onSearchSubmit={handleSearchSubmit}
  onSearchClear={handleSearchClear}
  contentTypes={contentTypeOptions}
  subjects={subjectOptions}
  technology={technologyOptions}
  authors={authorOptions}
  selectedContentTypes={selectedContentTypes}
  selectedSubjects={selectedSubjects}
  selectedTechnology={selectedTechnology}
  selectedAuthors={selectedAuthors}
  onContentTypeChange={handleContentTypeChange}
  onSubjectChange={handleSubjectChange}
  onTechnologyChange={handleTechnologyChange}
  onAuthorChange={handleAuthorChange}
/>

Features

  • Four filter groups: Content Type, Subjects, Technology, Person
  • Collapsible sections: Content Type open by default; Subjects, Technology, Person closed. Sections with URL-selected filters expand on load
  • Technology icons: Options with iconSrc display icons (from /technologies/)
  • Disabled state: Options with 0 count greyed out
  • Scrollable lists: Subjects, Technology, Person have max height with scroll
  • Search bar: Inline search input with clear button

Notes

  • Uses FilterCheckbox internally; pass iconSrc in technology options for icons
  • Sections use chevron toggle with 200ms transition