🚀 Ship faster with premium components 🚀
Search documentation v1.2.0

Empty

Display a placeholder state when no data is available

Source Report Issue
How to add this block to your project
npm create webcore@latest add Empty

Use the Empty component to display a placeholder when no content or data is available. Use for empty lists, dashboards, carts, or search results. They can guide user action with CTAs to help users add data, retry, or explore alternatives, and reduce confusion by clearly explaining why content is missing and what your users can do about it.

Preview
No documents found
You haven't created any documents yet.
Get started by creating your first one.
How to use the Empty component in Astro
---
// Your import path may differ
import fileIcon from '@icons/file.svg?raw'
---
<Empty
icon={fileIcon}
title="No documents found"
text="You haven't created any documents yet."
buttons={[{ text: 'Create New' }]}
/>

The Empty component expects the following two props:

Optionally, you can set the icon and buttons props. The buttons prop expects an array of ButtonProps objects. The iconWithBackground prop can also be set to true to add a solid background to icons:

No documents found
You haven't created any documents yet.
Get started by creating your first one.
How to set icon backgrounds
<Empty
icon={fileIcon}
iconWithBackground={true}
title="No documents found"
text="You haven't created any documents yet."
buttons={[{ text: 'Create New' }]}
/>

To change the color of the background, you can edit your empty.module.scss file.

Buttons

To define multiple buttons, pass an array of objects to the buttons prop, where each object takes the form of ButtonProps with an additional text property that sets the label for the button:

Empty project
This project is currently empty.
Add your first folders and files.
How to set multiple buttons
<Empty
icon={rocketIcon}
title="Empty project"
text="This project is currently empty."
buttons={[
{ icon: folderIcon, text: 'New folder', href: '/create#folder' },
{ icon: fileIcon, text: 'New file', theme: 'secondary', href: '/create#file' }
]}
/>

API

type EmptyProps = {
icon?: string
iconWithBackground?: boolean
title: string
text: string
buttons?: ({
text: string
icon?: string
} & ButtonProps)[]
className?: string
}
PropPurpose
icon Sets the icon for the block. You can pass SVG strings, or an icon type in Astro.
iconWithBackground Adds a solid background to the icon.
title Sets the title of the block.
text Sets a text for the block under the title. Supports HTML markup.
buttons Sets an array of CTA buttons.
className Pass additional CSS classes for your Empty component.