shadcn.io is not affiliated with official shadcn/ui
Sample Data Onboarding Block for React
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.
Installation
Overview
Let a new user see the product with something in it before they have any data, with this sample-data step for React with Base UI. It is a setup panel of Platemoor, a restaurant operations app, ruled by Guides in bands. At the start three sample sets as native radio rows (Restaurant, Webshop, Agency), each saying what it holds; beside them the picked set's name, three counts and its first five rows in a native table, two columns of which drop on a phone, with a line that all of it is made up. A band under them says what is in the workspace: nothing yet, or the loaded set marked as samples. Load sample data is the one Shine Button; once the picked set is loaded it reads Loaded and waits quietly, and Remove sample data takes it out again.
FAQ
How do I add or change a sample set?
Edit SAMPLES. Each set has an id, a title, a blurb, a noun (what a row is called), its columns (each says whether it stays on a phone), counts (the first one is the row total) and exactly five rows, each with its cells in column order. Keep five rows per set so the table never changes height. The counts are typed once and read everywhere: the row's hint, the counts, the caption and the status sentence.
How does it stay honest that these are samples?
Every place that mentions the data says so: “Showing 5 of 120 orders. All of it is made up.” under the table, “They are marked as samples” in the status, and the buttons say “sample data”. Loading and removing change only a typed state in the tab, and the status adds “Your own data was not touched.” when the samples are removed. Nothing is stored or sent.
What happens when a set is already loaded?
The picked set decides what the button says. If it is the loaded one the button reads Loaded and stays quiet: pressing it says the samples are already loaded and how to load them again. Picking a different set makes the button say Load sample data again, and pressing it replaces the loaded set. Remove sample data is always there; with nothing loaded it says there is nothing to remove.
Why is the table native, and how does it look on a phone?
A native table with a caption, scope on its heads and a focusable scroll region is the simplest accessible table, and it is the same on every base. Each column says whether it is phone; the others are hidden below the small breakpoint, so a phone shows three columns that fit without sideways scrolling.
What stays local in the demo, and how do I wire it?
Everything: the rows are typed in the file and Load sample data only says it loaded them. In your app create the sample records on your server where load says so, tag them as samples so they can be found and removed together, and delete exactly those where remove says so.
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 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.
- Pro
No Data Sources Empty State
Data and analyticsA full-height page for a data platform with no source yet: a segmented choice of database, file or API with that kind's fields, and a line drawing of a source pointing at a dashed data box that turns solid once the source is added.
- Pro
Sortable Members Table
Sort and searchA members table whose column heads are buttons: press one to sort, again to reverse, a third time for the original order, with aria-sort on the active head, ties settled by name and a spoken line for each result.
- Pro
A setup panel with a tags input that starts with five tags, refuses a repeat or a thirteenth in words, offers three suggestions as buttons and has Clear all with an Undo.
- 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.