Skip to content

Empty State Component

Overview

The <empty-state> component provides a standardized way to display empty state messages when there is no data to show. It helps provide a better user experience by explaining why content is missing and often suggesting actions to take.

Usage

html
<empty-state 
  title="No Projects Found" 
  description="You haven't created any projects yet." 
  icon="el-icon-folder"
></empty-state>

Props

PropTypeDefaultDescription
titleString'No Data'Main title text
descriptionString-Descriptive text explaining the empty state
iconString'el-icon-document'Icon to display above the title
imageString-Custom image URL to display instead of an icon
imageSizeNumber100Size of the image in pixels
buttonTextString-Text for the action button (if needed)
buttonTypeString'primary'Type of the action button (primary, success, warning, etc.)

Events

EventParametersDescription
action-Emitted when the action button is clicked

Slots

SlotDescription
defaultCustom content to replace the default empty state content
imageCustom content for the image/icon area
titleCustom content for the title area
descriptionCustom content for the description area
actionCustom content for the action area

Examples

Basic Usage

html
<empty-state 
  title="No Results Found" 
  description="Try adjusting your search criteria."
></empty-state>

With Action Button

html
<empty-state 
  title="Your Cart is Empty" 
  description="Add some products to your cart to continue shopping." 
  button-text="Browse Products"
  @action="navigateToProducts"
></empty-state>

With Custom Image

html
<empty-state 
  title="No Notifications" 
  description="You don't have any notifications at the moment." 
  image="/images/empty-notifications.svg"
  :image-size="150"
></empty-state>

With Custom Content

html
<empty-state>
  <template #image>
    <img src="/images/custom-empty.svg" alt="Empty state" />
  </template>
  
  <template #title>
    <h3 class="custom-title">Nothing to see here</h3>
  </template>
  
  <template #description>
    <p class="custom-description">This section is currently empty.</p>
    <p class="custom-hint">Check back later for updates.</p>
  </template>
  
  <template #action>
    <el-button type="success" @click="refresh">Refresh</el-button>
    <el-button @click="goBack">Go Back</el-button>
  </template>
</empty-state>

In a Content Box

html
<content-box title="User Activity">
  <empty-state 
    title="No Activity Yet" 
    description="This user hasn't performed any actions yet."
    icon="el-icon-time"
  ></empty-state>
</content-box>

u00a9 Velocitech LTD. All rights reserved.

Released under the Apache License 2.0.