shadcn.io is not affiliated with official shadcn/ui
Project Initializer Dialog Block for React
A scaffolding tool's welcome tab with a new-project dialog shown open: a numbered rail beside four selects, a project name in kebab case and a live command in a themed mono window that the Shine Button copies to your clipboard.
Installation
Overview
Turn four choices into a command people can paste, with this dialog for React with Base UI. It opens from the Welcome tab of Seedlathe, a project-scaffolding command line tool: the page's header holds an outline New project Button, and the tab itself, a Recent list, a drawn New project button and a terminal strip at the foot, is drawn under a soft scrim inside a hairline frame with a plus mark on each corner. The Dialog is a split: at the start a numbered rail, the Steps component read-only, lists Framework, Package manager, Lint and format and Tests with a hint each, and beside it four Selects in that order. Under them an Input names the project and writes it in kebab case, and a themed mono window shows the live command, which rewrites with every choice. The only Shine Button copies the command to your real clipboard, and the drawn terminal strip then shows the pasted line. Nothing runs. For preview the dialog is drawn open in place when the page loads; the header button opens the real Dialog.
FAQ
Why is the dialog already open, and what do I keep?
So you can see it without a click. On load the dialog is a copy drawn in place over the welcome tab: a native dialog element that isn't modal, so nothing is trapped, hidden or focused, and the page around the preview keeps working. The New project button opens the real Dialog, modal, with its focus trap, Escape and focus return, and the copy stays closed until a reload. Both show the same InitFields component and share the block's state, so what you chose in the copy is there in the real one. In your app keep the Dialog and drop the copy: the "in-place" state, the scrim and the dialog element inside the frame.
How is the command built?
commandOf joins the package manager, the create call, the project name and one flag per choice: --framework, --lint and --test. npm needs two dashes before the flags and yarn has no @latest, so those two are written their own way. The name goes through a small kebab-case helper: Sunny Day becomes sunny-day, an empty name falls back to my-app, and a name with no letters or numbers is refused with a short problem under the field. The window is text, so it wraps on a phone and you can select it by hand.
Does Copy command really copy, and does anything run?
It writes the command to your real clipboard, nothing more; the drawn terminal strip behind the dialog then shows it as if pasted. If your browser refuses, which it can on an insecure page, the dialog says so and stays open so you can select the command and copy it yourself. Nothing is installed and no command is run: the command line tool is fictional and the flags are typed here.
What does the rail show?
Which choices you have reached. The marker for a choice fills when you change it or one after it, and the next marker is outlined, so it reads as progress through the four. Every choice already has a default, so the rail is orientation, not a gate. On a phone the rail is hidden and each Select gets a numbered label of its own.
What stays local in the demo, and how do I wire it up?
All of it. The four lists of choices, the defaults and the recent projects are typed constants. In your app build the command from your own tool's options, keep the list of package managers to what your tool supports, and run the command in the user's terminal, never on your server.
Is it accessible from the keyboard?
Yes. The real dialog is named New project, focus starts inside and stays there until it closes, and Escape and the close button return focus to the header button. Each Select opens with Enter or the arrow keys and is named by its step title, the name field takes Enter to copy, and a polite message says what was chosen and when the command was copied. The trigger is passed to DialogTrigger through render, and the dialog is controlled with open and onOpenChange. The copy shown on load moves no focus; Escape inside it and its close button close it and put focus on the button.
Related
- Pro
Two-Step Setup Dialog
Account and securityA cloud editor's security page with a three-step dialog shown open: a QR code and its key, eight backup codes to copy or download, and a six-digit check, ending in a note that two-step sign-in is on.
- Pro
Password Generator Dialog
Account and securityA sign-up page with a dialog shown open that suggests a password: a mono output with Copy and a new one, Random or Passphrase, a length slider, four character switches and a strength worked out in bits.
- Pro
QR Scanner Dialog
Media and widgetsAn event check-in page with a simulated scanner dialog shown open: a viewfinder around a real sample QR code, a Wi-Fi, link and ticket payload read in turn, a result card that names the kind and cuts it into parts, a typed-code tab and a recent-scans strip.
- Pro
Setup Wizard Onboarding
Profile and accountA team workspace's first-run wizard as a whole screen: a rail of four steps (account, workspace, invites) that ends on a recap of every answer with an Edit button per section, and a Continue that checks each step first.
- Pro
API Key Dialog
Account and securityA keys page with its create-key dialog shown open: a name, scopes and an expiry in the first step, then the secret shown once, masked behind an eye button, with a Copy button and a box that has to be ticked before Done.
- Pro
Quick Actions Sandbox Onboarding
ChecklistsA document workspace's first four moves as a sandbox panel: four rows with Try and Undo buttons beside a small drawn workspace that adds a document, a teammate, a connected app and a reminder.