Skip to content
HomeCobalt

Filter bar

Narrows a list by several fields at once, each a pill that opens its options and names what it holds, so a person sees which filters are on without opening any.

Examples

Each pill names what it holds. Clear keeps its place at the end of the row while hidden, so it comes and goes without moving the pills.

3 funds

One choiceA size floor picks one option and closes; the pill reads the choice, and Clear in the list puts it back to any size.
Options still loadingThe adviser options load the first time the pill opens, so the list holds skeleton rows and says it is loading until they come; a failure offers Retry.
Searchable listPast 8 options the list opens with a search field, and the pill reads the first choice and how many more.
With a searchA search above the pills, which "/" reaches from anywhere on the page but a field; the key shows in the field until it is used. Assets is a range among the pills.
  • Harbour Large Cap CoreHedge fund
  • Calder Global EquityHedge fund
  • Northgate Short DurationPrivate credit
  • Pryor Dean Real AssetsReal estate
  • Ashby Wren GrowthPrivate equity
  • Hollis Crane IncomePrivate credit
  • Marlow Kent OpportunitiesHedge fund
In a data tableThe table opens narrowed to one room from the Room column's header, whose menu holds the same options as a filter pill.
BK-48204Hanna LindqvistHarbour suite$441.00
BK-48208Lukas BrandtHarbour suite$229.00
BK-48212Tomás IbarraHarbour suite$617.00
BK-48216Amara OkaforHarbour suite$405.00

Usage

Use it when

  • A list of records a person narrows by several fields at once: funds by type and domicile, bookings by room and status.
  • A field with a known set of values, a few or a few hundred, where a count per value helps choose.

Use something else when

  • One filter of two to six choices that are always in view, such as Upcoming and Past. Use SegmentedControl instead.
  • A free search over names. Use Input instead, with type="search", beside the bar.
  • Values from a server too many to list, such as every adviser. Use Combobox instead, which searches as you type.
  • A filter of one on and off choice, such as Late filings. Use Pill instead.

Rules

General

Content

Avoid

Limits

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/filter-bar.json
import { FilterBar, FilterPill, FilterList, filterSummary, filterCount, filterLabels, slashFocusesSearch, type Filter, type ListFilter, type RangeFilterItem, type FilterSearch, type FilterOption } from "@/components/cobalt/ui/filter-bar"