Database

Views Menu & New View

The “N more…” list of views and the “Add a new view” layout grid that opens beside it.

Table
Board
Gallery
List
Calendar
Timeline
Chart
New view
New data source

Usage

  • Use ViewsMenu when a database has more views than fit in the tab row (“N more…”).
  • Open NewViewMenu beside it (or on its own) to add a view; only supported layouts call onSelect.
  • Set newViewHighlighted while the grid is open so people see where it came from.
  • Don’t use the views menu for navigation between pages; use the sidebar or breadcrumbs instead.

Installation

Install the package (React 19):

terminal
npm install @krackedui/motion

Import the styles once, in your app entry or root layout:

/src/main.tsx
import '@krackedui/motion/styles.css';

Use it anywhere inside your app's <Theme> (see Installation):

/src/ViewsMenuNewViewExample.tsx
import { useState } from 'react';
import { ViewsMenu, createTasksSample } from '@krackedui/motion';

export function ViewsMenuNewViewExample() {
  const { views } = createTasksSample();
  const [activeViewId, setActiveViewId] = useState('v-table');

  return (
    <ViewsMenu
      views={views}
      activeViewId={activeViewId}
      onSelect={(v) => setActiveViewId(v.id)}
      onNewView={() => console.log('Open the new view grid')}
    />
  );
}

Examples

New view grid

Add a new view

New view highlighted

Table
Board
Gallery
List
Calendar
Timeline
Chart
New view
New data source

Composition

anatomy
<ViewsMenu>                     // 290 wide
  DbMenuSearch "Search for a view…"
  view row × n (role="option") → drag handle · view icon · name · "…"
  DbMenuRule · New view · New data source

<NewViewMenu>                   // 390 wide, 4-column grid
  "Add a new view" · gridcell × 11 (Table, Board, Gallery, List, Chart, Dashboard,
                                    Timeline, Feed, Map, Calendar, Form)
</NewViewMenu>

API Reference

ViewsMenu

Based on <div> (except onSelect). Adds:

PropTypeDefault
views
View[]
activeViewId
string
onSelect
(view: View) => void
onNewView
() => void
newViewHighlighted
boolean
false

NewViewMenu

Based on <div> (except onSelect). The cells come from newViewLayouts.

PropTypeDefault
onSelect
(type: ViewType) => void
highlighted
string

Accessibility

  • View rows are role="option" with aria-selected for the active view; ArrowUp/ArrowDown and Enter (useMenuKeys).
  • Grid cells are buttons in a role="grid"; layouts this package does not render (Dashboard, Feed, Map, Form) are aria-disabled.
© 2026 Motion. Internal documentation.