Empty state
What a list shows before it has anything in it: a card with a dithered band in your accent colour, a small drawing of stacked cards, two lines of text and the one thing to do next.
Options
Code
import "./empty-state.css";
/* <EmptyState title="No projects yet" text="Start your first one…" action="New project" onAction={create} other="Import" otherHref="/import" /> */
export function EmptyState({ title, text, action, onAction, other, otherHref = "#" }) {
return (
<div className="dh-empty">
<div className="dh-empty-top" aria-hidden="true" />
<div className="dh-empty-art" aria-hidden="true">
<span />
<span />
<span>
<i />
<b />
<b />
</span>
</div>
<p className="dh-empty-title">{title}</p>
<p className="dh-empty-text">{text}</p>
{(action || other) && (
<div className="dh-empty-actions">
{action && (
<button className="dh-empty-action" type="button" onClick={onAction}>
<svg viewBox="0 0 12 12" aria-hidden="true">
<path d="M6 2.5v7M2.5 6h7" />
</svg>
{action}
</button>
)}
{other && (
<a className="dh-empty-other" href={otherHref}>
{other}
</a>
)}
</div>
)}
</div>
);
}
export function Example() {
return <EmptyState title="No projects yet" text="Start your first one and it will show up here." action="New project" other="Import" />;
}/* What a list shows before it has anything in it: a card with a dithered band
in your accent colour, a small drawing of stacked cards, two lines of text
and the one thing to do next. */
.dh-empty {
--accent: var(--dh-accent, #2563ff);
--line: color-mix(in srgb, var(--dh-fg, #171717) 9%, transparent);
--ease: cubic-bezier(0.23, 1, 0.32, 1);
position: relative;
display: grid;
justify-items: center;
width: 340px;
max-width: 100%;
overflow: hidden;
padding: 0 24px 24px;
border-radius: 14px;
background: var(--dh-raised, #fff);
box-shadow:
0 0 0 1px var(--line),
0 1px 2px color-mix(in srgb, var(--dh-fg, #171717) 10%, transparent);
color: var(--dh-fg, #171717);
font-family: inherit;
font-size: 13px;
line-height: 20px;
text-align: center;
}
.dh-empty *,
.dh-empty *::before,
.dh-empty *::after {
box-sizing: border-box;
}
/* The band is solid at the top and breaks into dots lower down. */
.dh-empty-top {
position: absolute;
inset: 0 0 auto;
height: 112px;
background: linear-gradient(color-mix(in srgb, var(--accent) 82%, #000), var(--accent));
-webkit-mask-image: linear-gradient(#000 30%, transparent), radial-gradient(circle, #000 1.3px, transparent 1.6px);
mask-image: linear-gradient(#000 30%, transparent), radial-gradient(circle, #000 1.3px, transparent 1.6px);
-webkit-mask-size: auto, 5px 5px;
mask-size: auto, 5px 5px;
}
/* Three cards in a pile. The front one holds a dashed ring and two bars,
standing in for a row that has not been made yet. */
.dh-empty-art {
position: relative;
width: 132px;
height: 64px;
margin-top: 44px;
animation: dh-empty-in 0.5s var(--ease) both;
}
.dh-empty-art span {
position: absolute;
inset: 0;
border-radius: 10px;
background: var(--dh-raised, #fff);
box-shadow:
0 0 0 1px var(--line),
0 1px 2px color-mix(in srgb, var(--dh-fg, #171717) 10%, transparent),
0 8px 16px -8px color-mix(in srgb, var(--dh-fg, #171717) 24%, transparent);
}
.dh-empty-art span:nth-child(1) {
transform: translateY(-14px) scale(0.84);
opacity: 0.6;
}
.dh-empty-art span:nth-child(2) {
transform: translateY(-7px) scale(0.92);
opacity: 0.85;
}
.dh-empty-art span:nth-child(3) {
display: grid;
grid-template-columns: auto 1fr;
align-content: center;
gap: 6px 10px;
padding: 0 14px;
}
.dh-empty-art i {
grid-row: span 2;
align-self: center;
width: 28px;
height: 28px;
border: 1.5px dashed color-mix(in srgb, var(--accent) 60%, var(--dh-faint, #8a8a8a));
border-radius: 50%;
background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.dh-empty-art b {
width: 100%;
height: 6px;
border-radius: 3px;
background: var(--dh-well, #ededeb);
}
.dh-empty-art b:last-child {
width: 58%;
}
.dh-empty p {
margin: 0;
}
.dh-empty-title {
margin-top: 20px !important;
font-size: 14px;
font-weight: 500;
letter-spacing: -0.015em;
}
.dh-empty-text {
max-width: 220px;
margin-top: 2px !important;
color: var(--dh-muted, #5c5c5c);
}
.dh-empty-actions {
display: flex;
gap: 8px;
margin-top: 16px;
}
.dh-empty-actions > * {
display: inline-flex;
align-items: center;
gap: 6px;
height: 32px;
padding: 0 12px;
border: 0;
border-radius: 8px;
font: inherit;
font-weight: 500;
letter-spacing: -0.01em;
text-decoration: none;
cursor: pointer;
transition: transform 150ms var(--ease);
}
.dh-empty-action {
padding-left: 9px;
background: linear-gradient(color-mix(in srgb, var(--accent) 84%, #fff), var(--accent));
box-shadow:
inset 0 1px 0 rgb(255 255 255 / 0.3),
0 0 0 1px color-mix(in srgb, var(--accent) 78%, #000),
0 1px 2px color-mix(in srgb, var(--dh-fg, #171717) 22%, transparent);
color: var(--dh-on-accent, #fff);
}
.dh-empty-action svg {
width: 12px;
height: 12px;
fill: none;
stroke: currentColor;
stroke-width: 1.6;
stroke-linecap: round;
}
.dh-empty-other {
background: var(--dh-raised, #fff);
box-shadow:
0 0 0 1px var(--line),
0 1px 2px color-mix(in srgb, var(--dh-fg, #171717) 10%, transparent);
color: inherit;
}
.dh-empty-actions > *:active {
transform: scale(0.97);
}
.dh-empty-actions > *:focus-visible {
outline: 2px solid var(--dh-faint, #8a8a8a);
outline-offset: 2px;
}
@keyframes dh-empty-in {
from {
opacity: 0;
filter: blur(4px);
transform: translateY(6px);
}
}
@media (prefers-reduced-motion: reduce) {
.dh-empty-art {
animation: none;
}
.dh-empty-actions > * {
transition: none;
}
}<div class="dh-empty">
<div class="dh-empty-top" aria-hidden="true"></div>
<div class="dh-empty-art" aria-hidden="true">
<span></span>
<span></span>
<span><i></i><b></b><b></b></span>
</div>
<p class="dh-empty-title">No projects yet</p>
<p class="dh-empty-text">Start your first one and it will show up here.</p>
<div class="dh-empty-actions">
<button class="dh-empty-action" type="button">
<svg viewBox="0 0 12 12" aria-hidden="true"><path d="M6 2.5v7M2.5 6h7" /></svg>
New project
</button>
<a class="dh-empty-other" href="#">Import</a>
</div>
</div>/* What a list shows before it has anything in it: a card with a dithered band
in your accent colour, a small drawing of stacked cards, two lines of text
and the one thing to do next. */
.dh-empty {
--accent: var(--dh-accent, #2563ff);
--line: color-mix(in srgb, var(--dh-fg, #171717) 9%, transparent);
--ease: cubic-bezier(0.23, 1, 0.32, 1);
position: relative;
display: grid;
justify-items: center;
width: 340px;
max-width: 100%;
overflow: hidden;
padding: 0 24px 24px;
border-radius: 14px;
background: var(--dh-raised, #fff);
box-shadow:
0 0 0 1px var(--line),
0 1px 2px color-mix(in srgb, var(--dh-fg, #171717) 10%, transparent);
color: var(--dh-fg, #171717);
font-family: inherit;
font-size: 13px;
line-height: 20px;
text-align: center;
}
.dh-empty *,
.dh-empty *::before,
.dh-empty *::after {
box-sizing: border-box;
}
/* The band is solid at the top and breaks into dots lower down. */
.dh-empty-top {
position: absolute;
inset: 0 0 auto;
height: 112px;
background: linear-gradient(color-mix(in srgb, var(--accent) 82%, #000), var(--accent));
-webkit-mask-image: linear-gradient(#000 30%, transparent), radial-gradient(circle, #000 1.3px, transparent 1.6px);
mask-image: linear-gradient(#000 30%, transparent), radial-gradient(circle, #000 1.3px, transparent 1.6px);
-webkit-mask-size: auto, 5px 5px;
mask-size: auto, 5px 5px;
}
/* Three cards in a pile. The front one holds a dashed ring and two bars,
standing in for a row that has not been made yet. */
.dh-empty-art {
position: relative;
width: 132px;
height: 64px;
margin-top: 44px;
animation: dh-empty-in 0.5s var(--ease) both;
}
.dh-empty-art span {
position: absolute;
inset: 0;
border-radius: 10px;
background: var(--dh-raised, #fff);
box-shadow:
0 0 0 1px var(--line),
0 1px 2px color-mix(in srgb, var(--dh-fg, #171717) 10%, transparent),
0 8px 16px -8px color-mix(in srgb, var(--dh-fg, #171717) 24%, transparent);
}
.dh-empty-art span:nth-child(1) {
transform: translateY(-14px) scale(0.84);
opacity: 0.6;
}
.dh-empty-art span:nth-child(2) {
transform: translateY(-7px) scale(0.92);
opacity: 0.85;
}
.dh-empty-art span:nth-child(3) {
display: grid;
grid-template-columns: auto 1fr;
align-content: center;
gap: 6px 10px;
padding: 0 14px;
}
.dh-empty-art i {
grid-row: span 2;
align-self: center;
width: 28px;
height: 28px;
border: 1.5px dashed color-mix(in srgb, var(--accent) 60%, var(--dh-faint, #8a8a8a));
border-radius: 50%;
background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.dh-empty-art b {
width: 100%;
height: 6px;
border-radius: 3px;
background: var(--dh-well, #ededeb);
}
.dh-empty-art b:last-child {
width: 58%;
}
.dh-empty p {
margin: 0;
}
.dh-empty-title {
margin-top: 20px !important;
font-size: 14px;
font-weight: 500;
letter-spacing: -0.015em;
}
.dh-empty-text {
max-width: 220px;
margin-top: 2px !important;
color: var(--dh-muted, #5c5c5c);
}
.dh-empty-actions {
display: flex;
gap: 8px;
margin-top: 16px;
}
.dh-empty-actions > * {
display: inline-flex;
align-items: center;
gap: 6px;
height: 32px;
padding: 0 12px;
border: 0;
border-radius: 8px;
font: inherit;
font-weight: 500;
letter-spacing: -0.01em;
text-decoration: none;
cursor: pointer;
transition: transform 150ms var(--ease);
}
.dh-empty-action {
padding-left: 9px;
background: linear-gradient(color-mix(in srgb, var(--accent) 84%, #fff), var(--accent));
box-shadow:
inset 0 1px 0 rgb(255 255 255 / 0.3),
0 0 0 1px color-mix(in srgb, var(--accent) 78%, #000),
0 1px 2px color-mix(in srgb, var(--dh-fg, #171717) 22%, transparent);
color: var(--dh-on-accent, #fff);
}
.dh-empty-action svg {
width: 12px;
height: 12px;
fill: none;
stroke: currentColor;
stroke-width: 1.6;
stroke-linecap: round;
}
.dh-empty-other {
background: var(--dh-raised, #fff);
box-shadow:
0 0 0 1px var(--line),
0 1px 2px color-mix(in srgb, var(--dh-fg, #171717) 10%, transparent);
color: inherit;
}
.dh-empty-actions > *:active {
transform: scale(0.97);
}
.dh-empty-actions > *:focus-visible {
outline: 2px solid var(--dh-faint, #8a8a8a);
outline-offset: 2px;
}
@keyframes dh-empty-in {
from {
opacity: 0;
filter: blur(4px);
transform: translateY(6px);
}
}
@media (prefers-reduced-motion: reduce) {
.dh-empty-art {
animation: none;
}
.dh-empty-actions > * {
transition: none;
}
}Empty state is not in the Figma file yet.
Use the React or HTML code for now.