# Saved view manager

Manage consumer-owned saved filters with native forms, sharing state and confirmed deletion.

Access: pro. Category: Blocks. Kind: composite.

## When to use

- Use it when a page needs manage consumer-owned saved filters with native forms, sharing state and confirmed deletion.
- Choose it inside an authenticated product surface when the host application owns routing, persistence, and service calls.

## Alternatives

- Choose empty-state instead when empty collections, search results and errors with a clear next action is the actual interface need, rather than saved view manager.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Saved view manager

```sh
npx shadcn@latest add @tidal-pro/saved-view-manager
```

Stylesheets: `components/ui/tidal.css`, `components/ui/saved-view-manager.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/saved-view-manager.css";
import{TidalSavedViewManager}from"./components/ui/saved-view-manager";
export default()=><div className="tidal-scope"><TidalSavedViewManager currentViewId={"example"} onCurrentViewChange={() => {}} title={"Demo"} views={[{id:"example",name:"Demo"}]}/></div>;
```

## Structured props

- `TidalSavedViewManager.currentViewId: string | null`: Required current view id value accepted by this exported component.
- `TidalSavedViewManager.onCurrentViewChange: (viewId: string, event: ChangeEvent<HTMLSelectElement>) => void`: Callback invoked when the current view change interaction is proposed.
- `TidalSavedViewManager.title: ReactNode`: Required title value accepted by this exported component.
- `TidalSavedViewManager.views: ReadonlyArray<TidalSavedView>`: Required views value accepted by this exported component.
- `TidalSavedViewManager.defaultAction?: TidalSavedViewToggleAction | undefined`: Optional default action value accepted by this exported component.
- `TidalSavedViewManager.deleteAction?: TidalSavedViewDeleteAction | undefined`: Optional delete action value accepted by this exported component.
- `TidalSavedViewManager.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalSavedViewManager.direction?: "ltr" | "rtl" | undefined` (default "ltr"): Optional direction value accepted by this exported component.
- `TidalSavedViewManager.disabled?: boolean | undefined` (default false): Optional disabled value accepted by this exported component.
- `TidalSavedViewManager.duplicateAction?: TidalSavedViewNameAction | undefined`: Optional duplicate action value accepted by this exported component.
- `TidalSavedViewManager.headingLevel?: "h2" | "h3" | "h4" | "h5" | undefined` (default "h2"): Optional heading level value accepted by this exported component.
- `TidalSavedViewManager.labels?: Partial<TidalSavedViewManagerLabels> | undefined`: Optional labels value accepted by this exported component.
- `TidalSavedViewManager.panelProps?: Omit<HTMLAttributes<HTMLElement>, "aria-disabled" | "children" | "dangerouslySetInnerHTML"> | undefined` (default {}): Optional panel props value accepted by this exported component.
- `TidalSavedViewManager.panelRef?: Ref<HTMLElement> | undefined`: Optional panel ref value accepted by this exported component.
- `TidalSavedViewManager.pendingAction?: { type: "rename" | "duplicate" | "default" | "shared" | "delete"; viewId: string; } | null | undefined` (default null): Optional pending action value accepted by this exported component.
- `TidalSavedViewManager.portalContainer?: HTMLElement | null | undefined`: Optional portal container value accepted by this exported component.
- `TidalSavedViewManager.renameAction?: TidalSavedViewNameAction | undefined`: Optional rename action value accepted by this exported component.
- `TidalSavedViewManager.selectProps?: NativeSelectProps | undefined` (default {}): Optional select props value accepted by this exported component.
- `TidalSavedViewManager.selectRef?: Ref<HTMLSelectElement> | undefined`: Optional select ref value accepted by this exported component.
- `TidalSavedViewManager.sharedAction?: TidalSavedViewToggleAction | undefined`: Optional shared action value accepted by this exported component.
- `TidalSavedViewManager.theme?: "light" | "dark" | undefined` (default "light"): Optional theme value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/saved-view-manager.tsx) | [Manifest](https://tidalui.com/examples/saved-view-manager.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
"use client";

import "./components/ui/tidal.css";

import { useRef, useState } from "react";

import { TidalSavedViewManager, type TidalSavedView } from "./components/ui/saved-view-manager";

import "./components/ui/saved-view-manager.css";

import "./components/ui/alert-dialog.css";



const tidalExampleStyles = ".tidal-scope .saved-view-manager-demo {\n  display: grid;\n  width: 100%;\n  max-width: 680px;\n  min-width: 0;\n  gap: 14px;\n}\n\n.tidal-scope .saved-view-manager-demo > footer {\n  display: flex;\n  min-width: 0;\n  align-items: start;\n  justify-content: space-between;\n  gap: 12px;\n  padding-inline: 2px;\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.5;\n}\n\n.tidal-scope .saved-view-manager-demo > footer p,\n.tidal-scope .saved-view-manager-demo > footer span {\n  min-width: 0;\n  margin: 0;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .saved-view-manager-demo > footer p {\n  color: var(--t-ink);\n}\n\n@media (max-width: 420px) {\n  .tidal-scope .saved-view-manager-demo > footer {\n    flex-direction: column;\n  }\n}";

const INITIAL_VIEWS: readonly TidalSavedView[] = [
  {
    id: "my-work",
    name: "My work",
    description: "Assigned work that needs attention this week.",
    filterSummary: "Assignee: me · Status: active · Updated: newest first",
    isDefault: true,
  },
  {
    id: "launch-readiness",
    name: "Launch readiness",
    description: "Open launch tasks across product, support and operations.",
    filterSummary: "Project: autumn launch · Status: open or blocked",
    isShared: true,
  },
  {
    id: "needs-review",
    name: "Needs review",
    description: "Recently completed work waiting for a final review.",
    filterSummary: "Status: review · Completed: past 7 days",
  },
];

export function SavedViewManagerDemo() {
  const [views, setViews] = useState<TidalSavedView[]>([...INITIAL_VIEWS]);
  const [currentId, setCurrentId] = useState<string | null>("my-work");
  const [status, setStatus] = useState("My work is selected.");
  const copyCounter = useRef(1);

  return (
    <div className="saved-view-manager-demo">
      <TidalSavedViewManager
        title="Saved views"
        description="Keep useful workspace filters ready for the next visit."
        views={views}
        currentViewId={currentId}
        onCurrentViewChange={(id) => {
          setCurrentId(id);
          const next = views.find((view) => view.id === id);
          setStatus(`${next?.name ?? "Saved view"} is selected.`);
        }}
        renameAction={{
          onRequest: (view, name, event) => {
            event.preventDefault();
            setViews((current) =>
              current.map((item) =>
                item.id === view.id ? { ...item, name } : item,
              ),
            );
            setStatus(`Renamed the local view to ${name}.`);
          },
        }}
        duplicateAction={{
          onRequest: (view, name, event) => {
            event.preventDefault();
            const id = `${view.id}-copy-${copyCounter.current++}`;
            setViews((current) => [
              ...current,
              {
                ...view,
                id,
                name,
                isDefault: false,
                isShared: false,
              },
            ]);
            setCurrentId(id);
            setStatus(`Created the local copy ${name}.`);
          },
        }}
        defaultAction={{
          onChange: (view, next) => {
            setViews((current) =>
              current.map((item) => ({
                ...item,
                isDefault: next ? item.id === view.id : false,
              })),
            );
            setStatus(
              next
                ? `${view.name} is the local default.`
                : `${view.name} is no longer the local default.`,
            );
          },
        }}
        sharedAction={{
          onChange: (view, next) => {
            setViews((current) =>
              current.map((item) =>
                item.id === view.id ? { ...item, isShared: next } : item,
              ),
            );
            setStatus(`${view.name} is now ${next ? "shared" : "private"}.`);
          },
        }}
        deleteAction={{
          onRequest: (view) => {
            const remaining = views.filter((item) => item.id !== view.id);
            setViews(remaining);
            if (currentId === view.id) setCurrentId(remaining[0]?.id ?? null);
            setStatus(`Removed ${view.name} from this local sample.`);
          },
        }}
      />
      <footer>
        <p role="status">{status}</p>
        <span>Local sample only. No views are saved or shared elsewhere.</span>
      </footer>
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <SavedViewManagerDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation.","Escape dismisses the open overlay where the underlying primitive supports dismissal."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Consumer-owned views require unique nonblank IDs and names, with optional description, exact filter summary, default/shared/disabled state. At most one view may be default. currentViewId/onCurrentViewChange provide controlled selection; null shows the localized unselected state and an unknown ID stays visible as unavailable for recovery. Optional renameAction and duplicateAction expose native trigger, form, text-input and submit attributes/refs; native form handlers run first, prevention suppresses the request, whitespace-only names show linked validation, and request callbacks receive the exact trimmed name and native submit event. Optional defaultAction and sharedAction expose pressed native buttons and propose only the next boolean state. Optional deleteAction composes Alert dialog for least-destructive focus, explicit confirmation, native trigger/cancel/confirm attributes/refs and bounded focus recovery when an accepted deletion removes its trigger. disabled and pendingAction make relevant controls inert and expose busy status. Optional h2-h5 heading level, localized labels, theme/direction/portal target, native select attrs/ref, panel attrs/ref and section attrs/ref are supported. Owned values, disclosure attributes, dangerous markup and misleading root availability/busy attributes are excluded and stripped. Consumers own filter definitions, naming policy, persistence, access control, sharing, deletion and every external effect. No request, network, storage or backend behavior is bundled.
