View Toolbar

Filter, sort and group the records a view shows.

12 records
Todo4
ENG-144Invoice PDF cuts off long company namesReported by three customers this week
Bug
★★★
Dec 2
GH
ENG-139Keyboard shortcuts for triage
Feature
★★★
Dec 11
GH
ENG-131Empty states for saved views
Design
★★★
AL
ENG-128Notifications arrive twice on mobile
Bug
★★★
In Progress3
ENG-142Sign-in link expires before the email arrives
Bug
★★★
Dec 4
AL
ENG-140SAML sign-in for the admin console
Feature
★★★
Dec 18
AT
ENG-135Draft release notes for 2.4
★★★
Dec 6
In Review3
ENG-137Export drops the last row of a filtered view
Bug
★★★
Dec 3
AT
ENG-126Bulk move issues between teams
Feature
★★★
Dec 9
GH
ENG-133Triage suggestions for new bug reports
Feature
★★★
Dec 10
Done2
ENG-121Webhook retries with backoff
Feature
★★★
Nov 27
AT
ENG-118Dark mode contrast on badges
Design
★★★
Nov 24
AL

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/filter

Usage

import { type Property, View } from "./ui/uicontext/components/domain/Record.ts"import { ViewToolbar } from "./ui/uicontext/components/kit/Filter.ts"
const Message = UiSchema.TaggedEnum({ ChangedView: { view: View } })// Keep one View in your model and pass it to the toolbar and to the List, Board or Data Grid under it.export const TaskToolbar = (h: Html.H<typeof Message.Type>, fields: ReadonlyArray<Property>, view: View) =>	ViewToolbar(h, {		props: { label: "Tasks", fields, view, layouts: ["list", "board", "table"] },		onEmit: {			RequestedView: ({ view }) => Message.ChangedView({ view }),			SelectedView: () => undefined,			RequestedSaveView: () => undefined,			RequestedDeleteView: () => undefined,			RequestedRenameView: () => undefined,			RequestedShareView: () => undefined,			RequestedEditField: () => undefined,		},	})

Examples

Filter groups and sort stacks

Ana's deals that are won or worth $50,000 or more, sorted by stage, then amount. Add a group from Filter, and more sort levels from Sort.

2 of 8 records
DealStageOwnerAmountClose dateSourceProbability
1Northwind Freight: fleet trackingProposalARAna Ruiz$84,000Dec 18Inbound60%
2Atlas Dental Group: 40 seatsWonARAna Ruiz$47,500Nov 28Referral100%
2 rows· 6 filtered out· This example only filters and sorts.

Filter bar

The filter on its own, over a list. It starts on bugs; add a condition for priority or assignee.

ENG-142Sign-in link expires before the email arrives
Bug
AL
ENG-137Export drops the last row of a filtered view
Bug
AT
ENG-128Notifications arrive twice on mobile
Bug
ENG-144Invoice PDF cuts off long company namesReported by three customers this week
Bug
GH

Locked views

A guest filters and sorts for themselves; saving, renaming and deleting stay with members.

Only members can change views
5 of 8 records

API reference

FilterBarComponent

Props

FilterBar props
NameTypeDefaultDescription
labelrequiredstring—What the bar filters, for its accessible name: "Issues"
agentIdstringfilter:<label>This bar's id for agents, unique on the page; filter:<label> by default
propertiesrequiredProperty[]—The properties a person can filter on
filterrequiredFilter—The conditions applied now; every change comes back as ChangedFilter
currentViewInput—The rest of the view this filter belongs to (layout, sort, grouping); a saved view keeps all of it
viewsSavedView[]—The saved views the bar lists to switch between
viewstring | null—The active view's id
saveAsbooleantrueWhether the bar offers "Save as view"; true by default (the View Toolbar saves whole views itself)
lockedstring—Why views can't be changed here: "Views are locked"
outcomeOutcome | null—Pass null before saving, then return the outcome for each new view request.
count{ shown, total }—How many items pass, of how many: "12 of 340"
localestring—The locale numbers and dates are formatted in; the browser's by default

Events

FilterBar events
EventPayloadDescription
ChangedFilter{ filter: Filter }The person changed the filter here; keep it as view state and pass it back as filter
SelectedView{ view: string }Show this saved view; pass its id back as view
RequestedSaveView{ view: string | null; label: string; config: View; request?: string }Save config (the current view with this filter) to the view (null: a new view named label)
RequestedDeleteView{ view: string }Delete this saved view

Agent actions

What agents can do with FilterBar
ActionDescription
SetFilterReplace the whole filter. Each condition is { key, op, value }: op from the field's ops; value an option value list for choices, text, a number, an ISO date, true/false
AddedConditionAdd one condition: key, and optionally op, value, and group (a group's index, to add inside it)
RemovedConditionRemove the condition at this index (in the group at group, when given)
AddedGroupAdd an empty group: its conditions count as one, joined by its own match (any by default)
RemovedGroupRemove the group at this index, with its conditions
ClearedFilterRemove every condition and group
ClickedViewSwitch to a saved view by id
ClickedSaveViewSave the current filter to the active view (shared views change for everyone)
SubmittedNewViewSave the current filter as a new view named label
ClickedDeleteViewasks firstDelete a saved view

ViewToolbarComponent

Props

ViewToolbar props
NameTypeDefaultDescription
labelrequiredstring—What the view shows, for accessible names: "Deals"
agentIdstringview:<label>This toolbar's id for agents, unique on the page; view:<label> by default
fieldsrequiredProperty[]—The fields the view can filter, sort, group and show
viewrequiredViewInput—The view as shown now; every change comes back as RequestedView
viewsSavedView[]—The saved views the switcher lists
activestring | null—The saved view being shown, by id; null when the view is unsaved
layoutsViewLayout[]—The layouts the switcher offers, in order; every layout by default
count{ shown, total }—How many records pass the filter, of how many
lockedstring—Why saved views can't be changed here: "Views are locked"
outcomeOutcome | null—Pass null before saving, then return the outcome for each new view request.
localestring—The locale numbers and dates are formatted in; the browser's by default
canCan(["editFields", "shareViews"])—"editFields" offers New field and Edit field in the Fields menu; "shareViews" offers sharing a saved view with everyone, and making a shared one private again

Events

ViewToolbar events
EventPayloadDescription
RequestedView{ view: View }The person changed the view (layout, filter, sort, grouping, fields); pass it back as view
SelectedView{ view: string }Show this saved view
RequestedSaveView{ view: string | null; label: string; config: View; request?: string }Save config to the view (null: a new view named label)
RequestedDeleteView{ view: string }Delete this saved view
RequestedRenameView{ view: string; label: string }Give this saved view a new name; pass the renamed view back in views
RequestedShareView{ view: string; shared: boolean }Share this saved view with everyone (true), or make it the person's own again (false)
RequestedEditField{ key: string | null }Open the field editor on this field, or on a new one (null)

Agent actions

What agents can do with ViewToolbar
ActionDescription
RequestedViewChange parts of the view; the rest stays. view: { layout?, filter?: { conditions: [{ key, op, value }], match }, sort?: [{ key, direction: asc|desc }], groupBy?: key|null, hidden?: [keys] }
PickedLayoutShow the records in another layout
ClickedViewSwitch to a saved view by id
ClickedSaveViewSave the view as it is now to the active saved view (shared views change for everyone)
SubmittedNewViewSave the view as it is now as a new view named label
ClickedResetViewUndo the unsaved changes to the active view
ClickedDeleteViewasks firstDelete a saved view
SubmittedRenameRename a saved view: { view: its id, label: the new name }
ClickedDuplicateViewCopy a saved view as a new view named after it
ClickedShareViewasks firstShare a saved view with everyone (shared: true), or make it private again (false)
PickedEditFieldOpen the field editor on a field by key, or on a new field (null)

Accessibility

  • The filter bar is a search landmark named for its records; saved views are a nav of links with the open one marked aria-current, and an unsaved view says so.
  • Each filter chip is a button named for the whole condition ("Edit filter: Status is Done") with a Remove button beside it; a rating value is a radio group.
  • The count of matching records is a status, so it's announced as filters change. Sort, group and fields are menus.
  • Agents add and remove conditions, switch and save views, and get the reason when a field doesn't exist or can't group.

Source