shadcn.io is not affiliated with official shadcn/ui
New Page Template Command Menu Block for React
A site builder's new-page menu shown open over its page tree: templates in five groups each with a drawn wireframe of six lines, a typed name that turns the list into Create from templates, and choosing one adds the page, with its slug, to the tree and selects it.
Installation
Overview
Start a page from a layout instead of a blank screen with this new page command menu for React with Base UI. It opens from the Site pages panel of Bloomfold, a site builder, whose header holds an outline field with its ⌘ K cap, and the builder is drawn under a soft scrim inside a hairline frame with a plus mark on each corner: a page tree beside a canvas. The menu is the catalog Command with eleven templates in five groups, Landing, Pricing, Blog, About and Contact, and each row carries a wireframe of six lines of its layout drawn in greys: a hero, a row of tiles, a form, a list. Type a page name and the list turns into "Create ‘Pricing 2’ from…": a blank page first, then the templates whose words match what you typed, or all of them when none do. Choosing one adds a page of that name to the tree behind the menu with its slug beside it, "/pricing-2", selects it, and draws its wireframe large on the canvas; a name that is taken gets the next free number. The tree holds six new pages in this demo, and nothing is saved or published. 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 with the same pages and query. For site builders, CMSs and any product that adds pages from templates.
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 drawn inline over a picture of the builder, 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 pages added in the copy are in the tree when the dialog opens. 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.
How does typing a name change the list?
While the input is empty the rows are the templates by group, and choosing one names the page after the template. Once something is typed the list becomes one group headed "Create ‘Name’ from…": a Blank page row, then the templates that any typed word starts a word of in their name, group or keywords ("pric" finds the Pricing templates), or all of them when nothing matches, so a new name is never a dead end. The heading shows the name the page will get and each row says ", as Name" to a screen reader.
How are the name and the slug made?
The name is what you typed, trimmed, with one space between words and at most 24 characters. The slug is that name with its accents and case folded away and every run of other characters turned into a dash, so "Pricing 2" is /pricing-2. If the slug is already used by one of the site's pages (the home page, pricing, blog and contact) or by a page you added, the name takes the next free number, so typing "Pricing" creates "Pricing 2", and the heading shows it before you choose.
What are the wireframes?
Each template is typed as six lines from a small kit of shapes (a title, a line, a short line, a button, a hero, three or two tiles, an image, a form, a list), drawn in greys with hairlines. The same kit draws the small one in a row and the large one on the canvas, so they can never disagree, and they are pictures: hidden from assistive technology, with the template's name and a one-line hint carrying the same facts.
What stays local, and how do I wire it?
All of it. The templates, the added pages and the selection are typed state in the block; nothing is saved, published or sent. In your app build TEMPLATES from your own, write the page and its blocks to your CMS in pick, and route to the new page; keep freeName so two pages never share an address.
Is it accessible from the keyboard?
Yes. Type to search or to name the page, the arrow keys move through the rows, Enter adds the highlighted template 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 tree and the canvas behind the menu are pictures; the status line says what was added.
How does it look on a phone?
The tree goes and the canvas stays; the wireframes in the rows shrink a little. The copy shown on load docks to the top of the page at full width, so the keyboard does not cover the foot; the key hints go and the count stays. The real dialog keeps the Command dialog's own phone layout.
Related
- Pro
Layout Switcher Command Menu
Visual pickersA dashboard configurator's layout switcher as a command menu docked at the end of the page: six layouts each with a greyscale diagram, a band that draws the highlighted one larger, and Enter to re-arrange the drawn dashboard, still under reduced motion.
- Pro
Basic Command Menu
Search everythingA team workspace's home page with its command menu shown open: eleven pages in three groups, a shortcut on the five most used, matches marked, an empty state that says what to try and a foot with the key hints and a spoken count.
- Pro
Navigation Command Menu
Pages and docsA bank back office's navigation menu shown open: 24 pages in three levels, each row the name over its whole path, a search that reads the path by the start of each word, and a tick on the page you are on.
- Pro
Reply Templates Command Menu
Edit and insertA help desk's reply library as a command menu shown open over a ticket: choosing a reply with slots turns the menu into a short form, a textarea previews the filled reply, and Enter inserts it.
- Pro
Snippet Library Command Menu
Edit and insertA code editor's snippet library as a command menu shown open over the editor: a language switch, a pane that follows the highlighted snippet with highlighted code and Copy, and Enter inserts it into the buffer.
- Pro
Quick Open Files Command Menu
Search everythingA 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.