Skip to main content
ninna-ui

EmptyState

EmptyState component is used to indicate when a resource is empty or unavailable. It provides a clear message and optional actions to guide users.

import { EmptyState } from "@ninna-ui/feedback"
pnpm add @ninna-ui/feedback

Requires @ninna-ui/core (auto-installed) + CSS setup.

View source

Usage

Import and use the EmptyState component to display empty or unavailable resource states.

import { EmptyState } from "@ninna-ui/feedback";
import { Button } from "@ninna-ui/primitives";
function SearchIcon(props) {
return (
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" {...props}>
<path strokeLinecap="round" strokeLinejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" />
</svg>
);
}
export default function Example() {
return (
<EmptyState
icon={<SearchIcon />}
title="No results found"
description="Try adjusting your search or filters."
action={<Button>Clear Filters</Button>}
/>
);
}

Basic

A simple empty state with title and description.

No results found

Try adjusting your search or filters to find what you're looking for.

With Icon

Add an icon to make the empty state more visually informative.

No search results

We couldn't find anything matching your search. Try different keywords.

Your inbox is empty

You don't have any messages yet. Start a conversation!

Sizes

Different sizes for various contexts.

No files

Upload files to get started

No files

Upload files to get started

No files

Upload files to get started

With Action

Add action buttons to guide users on what to do next.

No projects yet

Create your first project to get started.

Your cart is empty

Explore our products and add items to your cart.

Use Cases

Common empty state patterns for different scenarios.

No documents

You haven't created any documents yet. Start by creating your first document.

No team members

Invite team members to collaborate on this project.

All caught up!

You have no new notifications.

No results found

Try adjusting your search

Suggestions:

  • Try removing filters
  • Try different keywords
  • Check for typos

API Reference

Complete list of props for the EmptyState component.

Props

PropTypeDefaultDescription
title*string-Title text to display
descriptionstring-Description text below the title
iconReact.ReactNode-Icon to display above the title
size'sm' | 'md' | 'lg''md'Size of the empty state
actionReact.ReactNode-Action button or content below the description
childrenReact.ReactNode-Additional content below the description
classNamestring-Additional CSS classes

Accessibility

  • Uses role="status" to indicate the empty state
  • Sets aria-label to the title for screen readers
  • Icons are marked with aria-hidden="true" as they are decorative
  • Uses semantic heading for the title to maintain document structure
  • Action buttons are focusable and keyboard accessible