shadcn.io is not affiliated with official shadcn/ui
Template Selection Onboarding Block for React
A gallery of twelve drawn templates in three tabs, chosen as radio cards, each with a Preview that opens a dialog with a larger drawing and the pages it would make.
Installation
Overview
Let a new user start from a ready-made page, with this template step for React with Base UI. It is a step of Moldwick, a document-template gallery, as a whole screen: the page's rails and one band, the step header (“Step 3 of 6” and a hairline), the heading and one framed card. In it three Tabs (Planning, Writing, Engineering) hold four templates each as native radio cards on shared hairlines, two across on a phone and four across from the medium breakpoint. Every card draws its template as a greyscale mini-page, one of six recipes made of divs (lanes, a table, document lines, a calendar grid, a checklist, a timeline), over its name and a line about it, with a Preview button that opens a real Dialog: a larger drawing, the template's description and the pages it creates, and a way to choose it from there. A line under the gallery says what is chosen. Use this template is the one Shine Button, with a ghost Skip for now.
FAQ
How do I add or change templates?
Edit GROUPS: each group has a title and exactly four templates, each with an id, a title, a one-line blurb, the pages it makes, a drawing kind (lanes, table, doc, calendar, checklist or timeline) and a variant (0 or 1) that picks one of that recipe's two shapes. Keep four per group so every tab is the same height; the blurb is held to two lines so no card is taller than another.
How are the drawings made, and why are they not images?
Each is a few spans sized in container units (cqw) inside a box with a fixed 4:3 shape, so the same drawing is crisp in a 170 px card and in the 450 px preview, follows the theme, and costs no file. They are aria-hidden; the card's name and line carry the meaning. To use your own screenshots, replace Sketch with an image and keep its box.
What does Preview do, and where does focus go?
It opens the real dialog: it traps focus, closes with Escape, the Close button or a click outside, and puts focus back on the Preview button you pressed. In the dialog “Choose this template” picks it and closes; the line under the gallery then says what is chosen once the dialog has gone (a modal hides the page from screen readers while it is open). If the template is already chosen the button says “Chosen” and only closes.
What if nothing is chosen?
Use this template stays in the tab order and looks quiet until a card is chosen. Pressing it says “Choose a template first.” under the gallery and puts focus on the first card of the open tab. The line is always reserved, so nothing moves. The choice is kept when you change tab, so the template you chose in Planning is still chosen when you look at Writing.
What stays local in the demo, and how do I wire it?
Everything: choosing, previewing and Use this template change state in the tab, no page is created and Skip for now only says it was skipped. In your app create the pages where submit says so, from the chosen template id, and send the visitor into the first of them.
Related
- Pro
A project step split in two: a name with the key its tasks will carry and a three-way choice of how to start, beside a drawn board that follows the choice.
- Pro
A workspace step with a name, an address worked out from it and checked in words, two radio cells for who can open it, and a sentence that says what would be made.
- Pro
A setup panel with three sample sets as radio rows beside the picked set's first five rows and counts, a Load sample data button and a Remove that takes the samples out again.
- Pro
A setup panel with a tree of categories beside a drawn sidebar that mirrors it live, with rename, add, move up, move down, delete and undo for the picked category.
- Pro
No Templates Empty State
Files and docsA full-height page for a planning tool with no templates yet: four drawn layouts as a choice group, a large drawn preview of the chosen one, and a strip of four slots that fills as templates are added.
- Pro
Achievement Trail Onboarding
Milestones and recapsA language-learning app's first-run trail: eight milestones along a winding path drawn from hairlines, three reached, a you-are-here ring, a hover card per node, a rolling count and progress, and a button that previews the next unlock.