Skip to content

ProjectStatusFilterBar

Data-driven filter bar for project statuses. Derives the available status options from your projects (in canonical order), so there is no hardcoded option list to keep in sync. Pair with filterByStatus to apply the selection.

Import

tsx
import { ProjectStatusFilterBar } from '@manningworks/projex'

Usage

tsx
<ProjectStatusFilterBar
  projects={projects}
  value={selectedStatus}
  onChange={setSelectedStatus}
/>

Props

PropTypeRequiredDescription
projectsProjexProject[]YesProjects used to derive the available status options
valueProjectStatus | 'all'YesCurrently selected status
onChange(value: ProjectStatus | 'all') => voidYesCallback fired when a different status is selected
allLabelstringNoLabel for the "all" option (default 'All')
ariaLabelstringNoAccessible label for the group (default 'Filter by status')

Data Attributes

AttributeValueDescription
data-projex-filter-bar-Root container (from ProjectFilterBar)
data-projex-status-filter-bar-Status filter group
data-projex-filter-tag-Each filter tag
data-projex-filter-tag-active'true'Present on the active tag

Behavior

  • Returns null when projects is empty
  • Only statuses present in projects are rendered, ordered by the canonical PROJECT_STATUSES order (see getUniqueStatuses)
  • Clicking the already-selected value does not fire onChange

Example

tsx
import { useState } from 'react'
import { ProjectStatusFilterBar, filterByStatus, ProjectGrid } from '@manningworks/projex'

function ProjectShowcase({ projects }) {
  const [status, setStatus] = useState('all')

  const visibleProjects = filterByStatus(projects, status)

  return (
    <div>
      <ProjectStatusFilterBar
        projects={projects}
        value={status}
        onChange={setStatus}
      />
      <ProjectGrid>
        {visibleProjects.map(project => (
          <ProjectCard key={project.id}>
            <ProjectCard.Header project={project} />
            <ProjectCard.Description project={project} />
            <ProjectCard.Stats project={project} />
          </ProjectCard>
        ))}
      </ProjectGrid>
    </div>
  )
}