StealThis .dev

Empty States — First-use empty state

A polished first-use empty state for a Projects list, built to turn a blank screen into an inviting first step. It centers an inline SVG illustration under the headline No projects yet, supportive subtext, a primary Create your first project button and a secondary Import link. The primary action reveals an inline create form with a name field and accent swatches, then drops a freshly built project card onto the page with a confirming toast. A segmented switcher previews the illustration, icon and minimal styles in both inline-card and full-page layouts.

在 Lab 中打开
html css vanilla-js
目标: JS HTML

代码

First-use empty state

A first-run “Projects” screen for the fictional Loomstack workspace, framed by a product chrome of topbar and toolbar so the empty state reads in context. The centerpiece is a hand-drawn inline-SVG board illustration sitting above a clear hierarchy: the headline No projects yet, a one-sentence explanation, a primary Create your first project button, a secondary Import link, and a row of next-step hints. Everything is keyboard-usable with visible focus rings and AA-contrast text.

Three illustration styles ship in one component — a full illustration, a compact rounded icon tile, and a stripped-back minimal layout — toggled live from a segmented control, alongside an inline-card vs full-page layout switch so you can audition each combination. The minimal style drops the artwork and hints for the densest possible state, while full-page centers the content in a tall hero region.

Clicking the primary CTA swaps the empty block for an inline create form with a name field and four accent swatches (a keyboard-navigable radiogroup). Submitting builds a faux project card — initials avatar in the chosen accent, an Active badge, and a “Just now” timestamp — prepends it to the live list, and fires a confirming toast. Esc or Cancel returns to the empty state, the Import link raises its own toast, and the whole layout collapses to a single column down to 360px.

Illustrative UI only — fictional workspace, projects, and data.