State Sample
Draws a small picture of a page once it has content. Pass it to an empty State Panel so people see what they will get before they add anything.
Installation
pnpm dlx shadcn@latest add https://sprout.tulipfarm.ai/r/state-sample.jsonCopies State Sample into your app, installs the packages, and adds the styles. Then import it from @/components/ui/state-sample. Needs Tailwind CSS 4 and a components.json from shadcn init.
Install the following dependencies:
pnpm add clsx tailwind-mergeAdd Sprout base once per app: the
cn()helper and the design tokens.lib/sprout/classes.ts- Design tokens, for your global CSS
Copy and paste the following code into your project.
import { Fragment, type ComponentType, type HTMLAttributes, type ReactNode } from 'react'; import { cn } from '@/lib/sprout/classes'; export type SampleIcon = ComponentType<{ size?: number }>; export interface SampleWindowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> { icon: SampleIcon; trail: readonly string[]; tabs?: readonly string[] | undefined; label?: ReactNode; children: ReactNode; } export function SampleWindow({ icon: Icon, trail, tabs, label = 'Example', children, className, ...props }: SampleWindowProps) { return ( <div data-slot="state-sample" {...props} className={cn('sprout-state-sample', className)}> <div className="sprout-state-sample-bar"> <span className="sprout-state-sample-icon" aria-hidden="true"> <Icon size={14} /> </span> {trail.map((part, index) => ( <Fragment key={index}> {index > 0 && ( <span className="sprout-state-sample-faint" aria-hidden="true"> / </span> )} <span className="sprout-state-sample-crumb" data-current={index === trail.length - 1 ? '' : undefined}> {part} </span> </Fragment> ))} <span className="sprout-state-sample-faint" aria-hidden="true"> ··· </span> <span className="sprout-state-sample-label">{label}</span> </div> {tabs && tabs.length > 0 && ( <div className="sprout-state-sample-tabs"> {tabs.map((tab, index) => ( <span key={index} className="sprout-state-sample-tab" data-selected={index === 0 ? '' : undefined}> {tab} </span> ))} </div> )} {children} </div> ); } export const sampleColumnSizeNames = ['lg', 'md', 'sm'] as const; export type SampleColumnSize = (typeof sampleColumnSizeNames)[number]; export type SampleColumn = { label: string; size?: SampleColumnSize }; export interface SampleTableProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> { columns: readonly SampleColumn[]; rows: readonly (readonly ReactNode[])[]; } export function SampleTable({ columns, rows, className, ...props }: SampleTableProps) { return ( <div data-slot="state-sample-table" {...props} className={cn('sprout-state-sample-table', className)}> <div className="sprout-state-sample-head"> <span className="sprout-state-sample-check" aria-hidden="true" /> {columns.map((column, index) => ( <span key={index} className="sprout-state-sample-cell" data-size={column.size ?? 'md'}> {column.label} </span> ))} </div> {rows.map((row, rowIndex) => ( <div key={rowIndex} className="sprout-state-sample-row"> <span className="sprout-state-sample-check" aria-hidden="true" /> {row.map((cell, cellIndex) => ( <span key={cellIndex} className="sprout-state-sample-cell" data-size={columns[cellIndex]?.size ?? 'md'}> {cell} </span> ))} </div> ))} </div> ); } export type SampleListItem = { leading?: ReactNode; title: string; detail?: string; trailing?: ReactNode; }; export interface SampleListProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> { items: readonly SampleListItem[]; } export function SampleList({ items, className, ...props }: SampleListProps) { return ( <div data-slot="state-sample-list" {...props} className={cn('sprout-state-sample-list', className)}> {items.map((item, index) => ( <div key={index} className="sprout-state-sample-item"> {item.leading && <span className="sprout-state-sample-leading">{item.leading}</span>} <span className="sprout-state-sample-copy"> <span className="sprout-state-sample-title">{item.title}</span> {item.detail && <span className="sprout-state-sample-detail">{item.detail}</span>} </span> {item.trailing && <span className="sprout-state-sample-trailing">{item.trailing}</span>} </div> ))} </div> ); } export const sampleTextToneNames = ['default', 'strong', 'muted', 'link', 'mono'] as const; export type SampleTextTone = (typeof sampleTextToneNames)[number]; export interface SampleTextProps extends HTMLAttributes<HTMLSpanElement> { tone?: SampleTextTone | undefined; children: ReactNode; } export function SampleText({ tone = 'default', className, ...props }: SampleTextProps) { return ( <span data-slot="state-sample-text" data-tone={tone} {...props} className={cn('sprout-state-sample-text', className)} /> ); } export const sampleMarkToneNames = ['red', 'orange', 'green', 'blue', 'violet', 'teal'] as const; export type SampleMarkTone = (typeof sampleMarkToneNames)[number]; export const sampleMarkSizeNames = ['sm', 'md'] as const; export type SampleMarkSize = (typeof sampleMarkSizeNames)[number]; export interface SampleMarkProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> { tone: SampleMarkTone; size?: SampleMarkSize | undefined; } export function SampleMark({ tone, size = 'sm', className, ...props }: SampleMarkProps) { return ( <span data-slot="state-sample-mark" data-tone={tone} data-size={size} aria-hidden="true" {...props} className={cn('sprout-state-sample-mark', className)} /> ); } export const sampleBarWidthNames = ['sm', 'md', 'lg'] as const; export type SampleBarWidth = (typeof sampleBarWidthNames)[number]; export interface SampleBarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> { width?: SampleBarWidth | undefined; } export function SampleBar({ width = 'md', className, ...props }: SampleBarProps) { return ( <span data-slot="state-sample-bar" data-width={width} aria-hidden="true" {...props} className={cn('sprout-state-sample-placeholder', className)} /> ); } export interface SampleIconTileProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> { icon: SampleIcon; } export function SampleIconTile({ icon: Icon, className, ...props }: SampleIconTileProps) { return ( <span data-slot="state-sample-icon-tile" aria-hidden="true" {...props} className={cn('sprout-state-sample-icon-tile', className)} > <Icon size={14} /> </span> ); }Add the styles to your global CSS, after
@import "tailwindcss".@layer components { .sprout-state-sample, .sprout-state-sample-mark { --sprout-state-sample-pdf: oklch(61.65% .1939 27.02); --sprout-state-sample-sheet: oklch(57.34% .1422 151.05); --sprout-state-sample-document: oklch(53.55% .1755 260.83); --sprout-state-sample-slides: oklch(63.49% .1638 42.8); --sprout-state-sample-image: oklch(85.06% .0674 242.56); } .sprout-state-sample { min-width: 0; font-family: var(--sprout-font); font-size: var(--sprout-text-xs); color: var(--sprout-text); flex-direction: column; line-height: 1rem; display: flex; } .dark .sprout-state-sample, .dark.sprout-state-sample, .dark .sprout-state-sample-mark { --sprout-state-sample-image: oklch(57.61% .0841 245.81); } @media (prefers-color-scheme: dark) { :root:not(.light):not(.dark) .sprout-state-sample, :root:not(.light):not(.dark) .sprout-state-sample-mark { --sprout-state-sample-image: oklch(57.61% .0841 245.81); } } .sprout-state-sample-bar { border-bottom: 1px solid var(--sprout-line); white-space: nowrap; flex-shrink: 0; align-items: center; gap: .375rem; min-width: 0; height: 2.5rem; padding-inline: 1rem; display: flex; } .sprout-state-sample-icon { color: var(--sprout-muted); flex-shrink: 0; display: flex; } .sprout-state-sample-faint { color: var(--sprout-muted); flex-shrink: 0; } .sprout-state-sample-crumb { text-overflow: ellipsis; min-width: 0; color: var(--sprout-muted); overflow: hidden; } .sprout-state-sample-crumb[data-current] { color: var(--sprout-text); font-weight: 500; } .sprout-state-sample-label { border: 1px solid var(--sprout-line); color: var(--sprout-muted); border-radius: .25rem; flex-shrink: 0; margin-left: auto; padding-inline: .375rem; } .sprout-state-sample-tabs { border-bottom: 1px solid var(--sprout-line); flex-shrink: 0; align-items: center; gap: .25rem; padding: .375rem .75rem; display: flex; overflow: hidden; } .sprout-state-sample-tab { border-radius: var(--sprout-radius-control); color: var(--sprout-muted); white-space: nowrap; flex-shrink: 0; padding: .25rem .5rem; } .sprout-state-sample-tab[data-selected] { background: var(--sprout-hover); color: var(--sprout-text); font-weight: 500; } .sprout-state-sample-table, .sprout-state-sample-list { min-width: 0; } .sprout-state-sample-head, .sprout-state-sample-row { border-bottom: 1px solid var(--sprout-line); align-items: center; gap: .75rem; min-width: 0; padding-inline: 1rem; display: flex; } .sprout-state-sample-head { height: 2.25rem; color: var(--sprout-muted); } .sprout-state-sample-row { height: 2.5rem; } .sprout-state-sample-check { border: 1px solid var(--sprout-input); border-radius: .125rem; flex-shrink: 0; width: .75rem; height: .75rem; } .sprout-state-sample-cell { white-space: nowrap; flex: 1; align-items: center; gap: .5rem; min-width: 0; display: flex; overflow: hidden; } .sprout-state-sample-head .sprout-state-sample-cell { text-overflow: ellipsis; font-weight: 500; display: block; } .sprout-state-sample-cell[data-size="lg"] { flex: 1.6; } .sprout-state-sample-cell[data-size="sm"] { flex: none; width: 6rem; } .sprout-state-sample-item { border-bottom: 1px solid var(--sprout-line); align-items: center; gap: .75rem; min-width: 0; min-height: 3.5rem; padding: .625rem 1rem; display: flex; } .sprout-state-sample-leading, .sprout-state-sample-trailing { flex-shrink: 0; align-items: center; display: flex; } .sprout-state-sample-trailing { gap: .5rem; } .sprout-state-sample-copy { flex-direction: column; flex: 1; gap: .125rem; min-width: 0; display: flex; } .sprout-state-sample-title, .sprout-state-sample-detail, .sprout-state-sample-text { text-overflow: ellipsis; white-space: nowrap; min-width: 0; overflow: hidden; } .sprout-state-sample-title { font-size: var(--sprout-text-sm); color: var(--sprout-text); font-weight: 500; line-height: 1.25rem; } .sprout-state-sample-detail { color: var(--sprout-muted); } .sprout-state-sample-text[data-tone="strong"] { color: var(--sprout-text); font-weight: 500; } .sprout-state-sample-text[data-tone="muted"] { color: var(--sprout-muted); } .sprout-state-sample-text[data-tone="link"] { color: var(--sprout-info); } .sprout-state-sample-text[data-tone="mono"] { color: var(--sprout-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; } .sprout-state-sample-mark { --sprout-state-sample-from: var(--sprout-state-sample-pdf); --sprout-state-sample-to: var(--sprout-purple); background: linear-gradient(to bottom right, var(--sprout-state-sample-from), var(--sprout-state-sample-to)); border-radius: .125rem; flex-shrink: 0; width: .875rem; height: .875rem; } .sprout-state-sample-mark[data-size="md"] { border-radius: var(--sprout-radius-control); width: 1.75rem; height: 1.75rem; } .sprout-state-sample-mark[data-tone="orange"] { --sprout-state-sample-from: var(--sprout-state-sample-slides); --sprout-state-sample-to: var(--sprout-state-sample-pdf); } .sprout-state-sample-mark[data-tone="green"] { --sprout-state-sample-from: var(--sprout-state-sample-sheet); --sprout-state-sample-to: var(--sprout-blue); } .sprout-state-sample-mark[data-tone="blue"] { --sprout-state-sample-from: var(--sprout-state-sample-document); --sprout-state-sample-to: var(--sprout-purple); } .sprout-state-sample-mark[data-tone="violet"] { --sprout-state-sample-from: var(--sprout-purple); --sprout-state-sample-to: var(--sprout-state-sample-pdf); } .sprout-state-sample-mark[data-tone="teal"] { --sprout-state-sample-from: var(--sprout-green); --sprout-state-sample-to: var(--sprout-state-sample-image); } .sprout-state-sample-placeholder { background: var(--sprout-active); border-radius: 9999px; width: 50%; min-width: 0; height: .5rem; } .sprout-state-sample-placeholder[data-width="sm"] { width: 33.333%; } .sprout-state-sample-placeholder[data-width="lg"] { width: 75%; } .sprout-state-sample-icon-tile { border: 1px solid var(--sprout-line); border-radius: var(--sprout-radius-control); background: var(--sprout-surface); width: 1.75rem; height: 1.75rem; color: var(--sprout-muted); box-shadow: var(--sprout-shadow-control); flex-shrink: 0; justify-content: center; align-items: center; display: flex; } @media (forced-colors: active) { .sprout-state-sample-mark, .sprout-state-sample-placeholder { forced-color-adjust: none; border: 1px solid canvastext; } .sprout-state-sample-tab[data-selected] { outline: 1px solid canvastext; } } }Import it from
@/components/ui/state-sample. Update the paths if your@/alias points elsewhere.
pnpm add @tulipfarm/sprout@import "tailwindcss";
@import "@tulipfarm/sprout/styles.css";The package keeps the source and ships fixes with each release. Import from @tulipfarm/sprout/state-sample.
No files yet
Upload the documents your work depends on, like price lists, contracts, and policies. Files stay private until you share them.
List · folder tiles and file glyphs · two-part trail
Usage
import {
SampleIconTile,
SampleList,
SampleText,
SampleWindow,
} from "@tulipfarm/sprout/state-sample";
<StatePanel
kind="empty"
icon={ChatRound}
title="No chats yet"
description="Every private conversation is saved here."
sample={
<SampleWindow icon={ChatRound} trail={["Chats"]} tabs={["Active", "Archived"]}>
<SampleList
items={[
{
leading: <SampleIconTile icon={ChatRound} />,
title: "Draft a follow-up for Northwind",
detail: "Draft ready for your review",
trailing: <SampleText tone="muted">1h ago</SampleText>,
},
]}
/>
</SampleWindow>
}
>
<Button>Start a chat</Button>
</StatePanel>SampleWindow draws a title bar with icon, a breadcrumb trail, and an “Example” chip. Change the chip with label. The last trail part is the current page. Add tabs for a tab row; the first tab is selected. Put a list, a table, or your own content inside.
Every sample
These are the samples TulipFarm shows on its empty pages. Data, avatars, and file glyphs here are sample adapters; the package only draws the frame, rows, and placeholders.
Active projects
Archived projects
Track our suppliers with a name, contact email, payment terms, and region.
I’ll create a Suppliers table with these fields. Review the schema before approving.
Lists and tables
<SampleTable
columns={[
{ label: "Workflow", size: "wide" },
{ label: "Trigger" },
{ label: "Status", size: "narrow" },
]}
rows={[
[
<><SampleMark tone="green" /><SampleText tone="strong">Approve large discounts</SampleText></>,
<SampleText tone="muted">New quote</SampleText>,
<Badge variant="success">Active</Badge>,
],
]}
/>SampleList takes items. Each item has a title and optional detail, leading, and trailing content. Rows are at least 56px tall.
SampleTable takes columns and rows. A column size is "lg" (1.6 shares), "md" (1 share, the default), or "sm" (a fixed 96px). Each row starts with a decorative checkbox. Long text truncates with an ellipsis.
Parts
For SampleText, tone is "default", "strong", "muted", "link", or "mono". A SampleMark is a colored square. Its tone is red, orange, green, blue, violet, or teal, and its size is "sm" (14px) or "md" (28px). A SampleBar stands in for a value. Its width is "sm", "md", or "lg". A SampleIconTile puts an icon in a 28px tile.
smmdsmmdlgSampleIconTileSampleMark mdBrandIcon smAgentAvatar smFile glyphAccessibility
Samples are pictures, not controls. Nothing in them can be focused. Marks, bars, icon tiles, checkboxes, and trail separators are hidden from assistive technology. Inside a State Panel the whole sample is hidden and inert, so screen readers hear only the panel text.
Theme tokens
Lines use --sprout-line, text uses --sprout-text and--sprout-muted, links use --sprout-info, and bars use --sprout-active. Mark gradients have light and dark values set by the component.