npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@molecule/app-filter-bar-react

v1.0.2

Published

Composable, field-driven React filter bar

Readme

@molecule/app-filter-bar-react

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Composable, field-driven React filter bar.

Exports:

  • <FilterBar> — data-driven filter row with text, select, multi, and date-range fields.
  • FilterField, FilterValues types for configuring the fields + storing state.

Quick Start

import { useState } from 'react'
import { FilterBar } from '@molecule/app-filter-bar-react'
import type { FilterField, FilterValues } from '@molecule/app-filter-bar-react'

const fields: FilterField[] = [
  { id: 'search', type: 'text', label: 'Search' },
  {
    id: 'status',
    type: 'select',
    label: 'Status',
    options: [
      { value: 'active', label: 'Active' },
      { value: 'closed', label: 'Closed' },
    ],
  },
  { id: 'created', type: 'date-range', label: 'Created' },
]

function IssueFilters() {
  const [values, setValues] = useState<FilterValues>({})
  return (
    <FilterBar fields={fields} values={values} onChange={setValues} onClear={() => setValues({})} />
  )
}

Type

feature

Installation

npm install @molecule/app-filter-bar-react @molecule/app-react @molecule/app-ui @molecule/app-ui-react react
npm install -D @types/react

API

Interfaces

FilterBarProps

Props for {@link FilterBar}.

interface FilterBarProps {
  /** Field definitions. */
  fields: FilterField[]
  /** Current filter values keyed by field id. */
  values: FilterValues
  /** Called on any individual field change. */
  onChange: (next: FilterValues) => void
  /** Optional "Clear all" handler — renders a clear button when provided. */
  onClear?: () => void
  /** Extra right-side actions (e.g. "Add filter", "Save view"). */
  actions?: ReactNode
  /**
   * When `true`, renders each field's `label` above its input as a
   * 10px-uppercase-tracking-widest label (matching the polished flagship
   * apps' settings/filter sections). Default `false` keeps the original
   * unlabeled inline-row layout used by simple toolbar consumers.
   */
  showLabels?: boolean
  /** Extra classes. */
  className?: string
}

FilterFieldBase

Common properties shared by every filter field variant.

interface FilterFieldBase {
  /** Unique field id — used as the state key. */
  id: string
  /** Display label (usually `t('...')`). */
  label: string
  /** Optional placeholder inside the control. */
  placeholder?: string
}

FilterFieldDateRange

A date-range filter field with optional from/to bounds.

interface FilterFieldDateRange extends FilterFieldBase {
  type: 'date-range'
}

FilterFieldMulti

A multi-select filter field allowing multiple chosen values.

interface FilterFieldMulti extends FilterFieldBase {
  type: 'multi'
  options: Array<{ value: string; label: string }>
}

FilterFieldSelect

A single-value dropdown select filter field.

interface FilterFieldSelect extends FilterFieldBase {
  type: 'select'
  options: Array<{ value: string; label: string }>
}

FilterFieldText

A free-text input filter field.

interface FilterFieldText extends FilterFieldBase {
  type: 'text'
}

Types

FilterField

Discriminated union of all supported filter field types.

type FilterField = FilterFieldText | FilterFieldSelect | FilterFieldMulti | FilterFieldDateRange

FilterValues

Flat value map keyed by field id.

type FilterValues = Record<string, string | string[] | { from?: string; to?: string } | undefined>

Functions

FilterBar(props)

Data-driven filter bar. Renders one control per field in fields, emits a full updated values map on each change so parents can store filters in URL params, zustand, etc. Multi-select uses a comma-joined <Input> fallback since multi-select UI isn't in the primitives yet.

function FilterBar({
  fields,
  values,
  onChange,
  onClear,
  actions,
  showLabels = false,
  className,
}: FilterBarProps): ReactElement<unknown, string | JSXElementConstructor<any>>
  • props — Component props (see {@link FilterBarProps}).

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-react ^1.0.1
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-react ^1.0.1
  • react ^18.0.0 || ^19.0.0

Runtime Dependencies

  • @molecule/app-react
  • @molecule/app-ui
  • @molecule/app-ui-react
  • react

Fully controlled: every field change calls onChange with the FULL updated FilterValues map — store it in URL params / app state and pass it back via values.

type: 'multi' currently renders as a comma-separated text input (values are split on commas), not a multi-select control — plan UX accordingly or compose your own control via actions.

Set showLabels to render each field's label above its control (settings-page style); the default is a compact unlabeled toolbar row. Controls are the Input / Select / Button primitives from the @molecule/app-ui-react peer dependency.

Translations

Translation strings are provided by @molecule/app-locales-filter-bar.