Empty state
Fills an empty list or page with an icon, a short explanation and the next action to take.
Installation
bash
npx bootcn add emptybash
pnpm dlx bootcn add emptybash
yarn dlx bootcn add emptybash
bunx --bun bootcn add emptyThe CLI also installs the design tokens and these components: button. It prints the <link> and <script> tags to add to your layout.
Usage
Show it where a list, table or page would be, when there is nothing to show yet. Say why it is empty and offer the most useful next step.
Accessibility
- The title is a heading, so users can find the state; pick the level that fits your page.
- The icon is decorative.
Dependencies
- Bootstrap 5.3+ CSS.
themes/tokens/tokens.css.- The
buttoncomponent.
Source
The exact files the CLI installs (empty@1.0.0). View on GitHub · Report an issue
html
<div class="bootcn-empty">
<div class="bootcn-empty__media">
<svg
class="bootcn-icon"
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
focusable="false"
>
<path d="M3 6h6l2 2h10v11H3z" />
</svg>
</div>
<h2 class="bootcn-empty__title">No projects yet</h2>
<p class="bootcn-empty__description">
You have not created any projects. Start with a new one or import an existing site.
</p>
<div class="bootcn-empty__actions">
<button type="button" class="btn bootcn-button bootcn-button--default">Create project</button>
<button type="button" class="btn bootcn-button bootcn-button--outline">Import</button>
</div>
</div>css
.bootcn-empty {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
padding: 3rem 1.5rem;
border: var(--bootcn-border-width) dashed var(--bootcn-border-color);
border-radius: var(--bootcn-radius-xl);
text-align: center;
}
.bootcn-empty__media {
display: flex;
align-items: center;
justify-content: center;
width: 3rem;
height: 3rem;
margin-bottom: 0.5rem;
border-radius: var(--bootcn-radius-lg);
background-color: var(--bootcn-muted);
color: var(--bootcn-foreground);
}
.bootcn-empty__media .bootcn-icon {
width: 1.5rem;
height: 1.5rem;
}
.bootcn-empty__title {
margin: 0;
font-size: 1.125rem;
font-weight: 600;
}
.bootcn-empty__description {
max-width: 24rem;
margin: 0;
color: var(--bootcn-muted-foreground);
font-size: 0.875rem;
}
.bootcn-empty__actions {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 0.5rem;
margin-top: 1rem;
}
