Skip to content
nexubDesign System
v11.9.0

Components · Navigation

Saved Views

BetaAdded v5.5.0

A menu to switch, save, update and delete saved filter views. Your app stores them.

import { SavedViews } from '@nexub/react';
View as Markdown

Playground

Props

TSX
<SavedViews views={views} activeId={active} onSelect={setActive} onSave={…} onUpdate={() => {}} onDelete={…} />

Examples

Views for a deals table

Async, with a default view

Save, rename and delete wait on a request. Saving an existing name fails; deleting asks first.

Props

Props
PropTypeDefaultDescription
viewsrequiredSavedView[]—The saved views.
activeIdstring—The view in use; its name shows on the button.
onSelectrequired(id: string) => void—Switch to a view: restore its filters, sort and columns.
onSave((name: string) => MaybeAsync)—Adds "Save as new view…", which asks for a name. A returned promise keeps the dialog busy; a rejection shows its message.
onUpdate((id: string) => MaybeAsync)—Add "Update" and "Delete" for the active view. A returned promise holds the control busy; a rejection shows its message.
onDelete((id: string) => MaybeAsync)—Add "Update" and "Delete" for the active view. A returned promise holds the control busy; a rejection shows its message.
onRename((id: string, name: string) => MaybeAsync)—11.5: adds "Rename" for the active view, which asks for a new name.
confirmDeletebooleanfalse11.5: ask in an AlertDialog before deleting.
defaultViewstring—11.5: the default view’s id. Tagged "Default" in the menu, and applied once on mount when activeId is undefined.
maxLengthnumber—11.5: the longest name allowed when saving or renaming.
classNamestring—
sheetfalse | true | 'auto''auto' (pass `sheet={false}` to keep a popover on small screens)The menu as a bottom sheet: see DropdownMenu.Content sheet.

On iOS & Android