Prodular UI

Saved views

Pro

A bar of saved views over a table or report. Picking a view restores its filters, sorting and columns; changing them marks the view modified, with Save, Save as new and Reset.

npx prodular-ui add saved-views

Part of Prodular UI Pro. Preview and read the docs freely, install with a license. See pricing

Views over a data table

Two locked presets, a shared view and a personal one. Change a filter or sort to see Modified, then save it or save it as a new view.

INV-2109Bluefin MarineDraftTheo LindqvistNov 14$9,061
INV-2116Northwind LogisticsPaidMaya OkaforNov 13$8,944
INV-2123Kestrel HealthPaidHana SatoNov 12$8,827
INV-2130Halcyon RoboticsPaidPriya RamanNov 11$8,710
INV-2137Meridian FreightOpenTheo LindqvistNov 10$8,593
INV-2106Halcyon RoboticsPaidPriya RamanNov 8$17,254
INV-2113Meridian FreightOpenTheo LindqvistNov 7$17,137
INV-2120Lumen AnalyticsOpenMaya OkaforNov 6$17,020

1–8 of 36

Page 1 of 5

Anatomy

const { views, setViews, activeId, setActiveId } = useSavedViews({ initialViews })
<SavedViews  views={views}  onViewsChange={setViews}  activeId={activeId}  onActiveChange={(id, view) => { setActiveId(id); applyToTable(view.state) }}  state={currentState}/>

Guidance

Use it when

  • Tables, boards and reports that people revisit with the same filters, like Overdue or My accounts.
  • Locked presets for the views every team needs, and personal or shared views on top.
  • The same state object for the URL, so a view can be linked and shared.

Avoid

  • One-off filtering. The filter bar and chips are enough until people repeat themselves.
  • More than about eight views in the bar. Keep the rest behind search or a menu.
  • Saving row selection or scroll position. Views hold how to look at data, not where you were.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Define a ViewState type with everything a view restores (search, filters, sorting, column visibility, grouping) and keep it JSON.
  • Build the current state from the table on every render and pass it as state. SavedViews compares it with the active view to show Modified.
  • In onActiveChange, set the active id and apply view.state to the table: setGlobalFilter, setColumnFilters, setSorting, setColumnVisibility, then go to the first page.
  • Start the table with the default view's state, or it opens as modified.
  • Mark built-in presets locked. They can be duplicated but not renamed, saved over or deleted.
  • useSavedViews keeps views in React state, or in localStorage with storageKey. For shared views, load and save them through your API with onViewsChange.

API

SavedViews

PropTypeDefaultDescription
views / onViewsChangeSavedView<T>[] / (views) => voidViews: { id, name, state, shared?, locked? }.
activeId / onActiveChangestring / (id, view) => voidThe selected view. Apply view.state in the callback.
stateTThe current state, compared with the active view.
shareablebooleanfalseAdds Share with team when saving and in the view menu.
isEqual(a: T, b: T) => booleanCustom comparison. The default ignores key order.

useSavedViews

PropTypeDefaultDescription
({ initialViews, initialActiveId?, storageKey? }){ views, setViews, activeId, setActiveId, activeView }View state, optionally persisted in localStorage.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add saved-views# or, with the registry in components.jsonnpx shadcn@latest add @prodular/saved-views