Skip to content

EmptyState ​

An empty area: a list with no results, the first use of a feature, a loading error. It explains the situation and offers the next action.

Usage ​

First use ​

vue
<script setup>
import { FolderPlusIcon } from '@heroicons/vue/24/outline'
</script>

<template>
  <SuEmptyState :icon="FolderPlusIcon" title="No projects" description="Create your first project…" bordered>
    <SuButton>New project</SuButton>
    <SuButton variant="outline">Import</SuButton>
  </SuEmptyState>
</template>

No results ​

vue
<SuEmptyState :icon="MagnifyingGlassIcon" title="No results for “table”" size="sm">
  <SuButton variant="ghost">Clear search</SuButton>
</SuEmptyState>

API ​

Props ​

PropTypeDefaultDescription
titlestring-Title (or title slot)
descriptionstring-Explanation (or description slot)
iconComponent-Icon (or media slot for an illustration)
headingLevel2 | 3 | 4 | 5 | 63Heading level in the page
size'sm' | 'md' | 'lg''md'Size
borderedbooleanfalseDashed frame

Slots ​

SlotDescription
defaultActions (buttons, links)
mediaIllustration instead of the icon
title / descriptionRich title and explanation content

Accessibility ​

  • The title is a real heading (h2 to h6): pick headingLevel to match the page hierarchy.
  • The icon and illustration are decorative (aria-hidden).
  • When the empty state appears after a search, announce the result (useAnnouncer): the change is not read on its own.

Publié sous licence MIT.