Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Database Schema Explorer Command Menu Block for React

A database admin's table finder as a command menu shown open beside a schema pane: a switch between a read-only Production and a Staging connection, tables with their row counts, and a pane of the highlighted table's columns with a Copy SELECT button.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Find a table and see what is in it before you open it with this schema explorer command menu for React with Base UI. It opens from the Database screen of Rowmill, a database admin, whose header holds an outline field with its ⌘ K cap, and the admin is drawn under a soft scrim inside a hairline frame with a plus mark on each corner: a bar with a chip that names the connection and the table, a list of tables and a data grid made of shapes. The menu is the catalog Command in two columns. Above the list a ToggleGroup chooses the connection, Production or Staging, one always chosen, and says in words what it allows: Production is read-only, with a lock beside the word. Below it come that connection's tables, each with its column count and its row count in tabular numerals, filtered as you type by table name, keyword or column name. On the end side a pane follows the highlighted table: its name, its rows, the connection's mode, its columns with their types, PK or FK in words with the table a foreign key points at, and the SELECT statement built from its first six columns. Copy SELECT, or Alt and C on the highlighted table, really copies it; nothing is ever run. Choosing a table names it on the chip. For preview the menu is drawn open in place when the page loads; the field, or Ctrl or ⌘ K while focus is in the block, opens the real command dialog, wider, with the same list, connection and query. For database admins, query editors, data catalogs and any tool that has more tables than anyone remembers.

FAQ

Why is the menu already open, and what do I keep?

So you can see it without a click. On load the menu is the Command and its pane drawn inline over a picture of the admin, in a plain shell that is not modal, so nothing is trapped, hidden or focused and the page around the preview keeps working. The header's field opens the real command dialog, modal, with its focus trap, Escape and focus return, and the inline copy stays closed until a reload. Both show the same Palette and share the block's state, so the connection you chose and what you typed in the copy are in the real dialog. In your app keep the dialog and drop the copy: the "in-place" state, the scrim with its shell and the Escape and blur effects.

What does read-only mean here, and what changes between the two connections?

Production is typed as a connection that cannot write, and the menu says so in three places: the word beside the switch (with a lock), the badge in the pane and the status line after you choose a table ("Opened orders on Production, read-only."). Nothing in the block writes anywhere, so the label does not gate anything here; in your app it should come from the connection's real permissions. Switching connections changes the row counts and the list itself: Staging has one table Production does not, so the count in the foot changes from 7 tables to 8 and the switch is announced.

How does the pane follow the highlight?

The block keeps the highlighted row's id in state and the pane is a plain function of it. The Command is cmdk, whose highlighted value is controlled with value and onValueChange. When nothing is highlighted, or the highlighted table is not on the other connection, the pane shows the first row.

What does Copy SELECT copy, and is anything run?

It copies the statement shown in the pane, for example SELECT id, customer_id, status, currency, total_cents, placed_at FROM orders LIMIT 100;, through the clipboard, and the status line says "Copied the SELECT for orders. Nothing was run." If the browser refuses, it says so. The button is in the tab order; Alt and C does the same from the input without moving focus, reading the key from event.code so Option's characters on a Mac do not matter.

What stays local, and how do I wire it?

All of it. The connections, tables, columns and counts are typed and made up, no database is contacted and the statement is only text. In your app build TABLES from your schema (for example information_schema.columns), take the counts from your catalog or an estimate, and make pick open the table.

Is it accessible from the keyboard?

Yes. Tab reaches the connection switch, then the input; type to search, the arrow keys move through the tables, Enter opens the highlighted one and Escape closes the menu and puts focus on the field; Ctrl or ⌘ K opens the dialog while focus is inside the block, and only then. The rows are options of a cmdk listbox; the block turns off its own fuzzy filter and lists the rows itself. The pane is a labelled region that is not read out as you move; the list announces the rows.

How does it look on a phone?

The pane is dropped and each row shows its column count and its row count under the name, so you can still tell tables apart. The copy shown on load docks to the top of the page at full width, the key hints go and the count stays. The real dialog keeps the Command dialog's own phone layout.

  • Pro

    A database client's connection switcher as a command menu shown open over a query editor: five connections with engine, host, database and a state in words, a Test button or Alt T that runs a simulated test with a spinner and a typed result, and a toolbar chip that follows the choice.

  • Pro

    A payload inspector's path browser as a command menu shown open beside a value pane: the keys of an object or array with their type as a word, a path bar in monospace, the arrow keys going in and out, a typed path that jumps there, and a copy path button.

  • Pro

    A localisation platform's string finder as a command menu shown open under a band of language chips with their coverage: keys with their text in the chosen language or the word Missing, a Missing only switch and a copy key button.

  • Pro

    A git client's project switcher as a command menu shown open at the centre of the title bar: pinned and recent repositories with branch, host, ahead and behind, a switch that keeps only projects with changes, and a title bar and file tree that follow the choice.

  • Pro

    A cloud drive's quick open as a command menu shown open at the top of a file manager: recent files first, a search across every folder, middle-shortened paths with sizes and dates, kind chips and a sort, and the chosen row selected in the table behind.

  • Pro

    Docs Search Command Menu

    Search everything

    A docs host's scoped search shown open under the header field: chips for All, Guides, Reference and Releases that carry how many pages match, and results with a path and one line of the page with the matched words marked.