• Blog
  • Documentation
  • Courses
  • Changelog
  • AI Starters
  • UI Kit
  • FAQ
  • Supamode
    New
  • Pricing

Launch your next SaaS in record time with Makerkit, a React SaaS Boilerplate for Next.js and Supabase.

Makerkit is a product of Makerkit Pte Ltd (registered in the Republic of Singapore)Company Registration No: 202407149CFor support or inquiries, please contact us

About
  • FAQ
  • Contact
  • Verify your Discord
  • Consultation
  • Open Source
  • Become an Affiliate
Product
  • Documentation
  • Blog
  • Changelog
  • UI Blocks
  • Figma UI Kit
  • AI SaaS Starters
License
  • Activate License
  • Upgrade License
  • Invite Member
Legal
  • Terms of License
    • Shadcn UI
    • Multi Step Forms
    • Stepper
    • Data Table
    • Loading Overlay
    • Conditional Rendering
    • Page
    • App Breadcrumbs
    • Card Button
    • Cookie Banner
    • Empty State
    • Bordered Navigation Menu
    • Marketing Components
    • Temporary Landing Page

Empty State Component in the Next.js Supabase SaaS kit

Learn how to use the Empty State component in the Next.js Supabase SaaS kit

The EmptyState component is a flexible and reusable UI element designed to display when there's no content to show. It's perfect for scenarios like empty lists, search results with no matches, or initial states of features.

Components

  1. EmptyState: The main wrapper component
  2. EmptyStateHeading: For the main heading
  3. EmptyStateText: For descriptive text
  4. EmptyStateButton: For a call-to-action button

Usage

jsx
import { EmptyState, EmptyStateHeading, EmptyStateText, EmptyStateButton } from '@kit/ui/empty-state';
function MyComponent() {
return (
<EmptyState>
<EmptyStateHeading>No results found</EmptyStateHeading>
<EmptyStateText>Try adjusting your search or filter to find what you're looking for.</EmptyStateText>
<EmptyStateButton>Clear filters</EmptyStateButton>
</EmptyState>
);
}

Component Details

EmptyState

The main container that wraps all other components.

  • Props: Accepts all standard div props
  • Styling:
  • Flex container with centered content
  • Rounded corners with a dashed border
  • Light shadow for depth

EmptyStateHeading

Used for the main heading of the empty state.

  • Props: Accepts all standard h3 props
  • Styling:
  • Large text (2xl)
  • Bold font
  • Tight letter spacing

EmptyStateText

For descriptive text explaining the empty state or providing guidance.

  • Props: Accepts all standard p props
  • Styling:
  • Small text
  • Muted color for less emphasis

EmptyStateButton

A button component for primary actions.

  • Props: Accepts all props from the base Button component
  • Styling:
  • Margin top for spacing
  • Inherits styles from the base Button component

Features

  1. Flexible Structure: Components can be used in any order, and additional custom elements can be added.
  2. Automatic Layout: The component automatically arranges its children in a centered, vertical layout.
  3. Customizable: Each subcomponent accepts className props for custom styling.
  4. Type-Safe: Utilizes TypeScript for prop type checking.

Customization

You can customize the appearance of each component by passing a className prop:

tsx
<EmptyState className="bg-gray-100">
<EmptyStateHeading className="text-primary">Custom Heading</EmptyStateHeading>
<EmptyStateText className="text-lg">Larger descriptive text</EmptyStateText>
<EmptyStateButton className="bg-secondary">Custom Button</EmptyStateButton>
</EmptyState>

This EmptyState component provides a clean, consistent way to handle empty states in your application. Its modular design allows for easy customization while maintaining a cohesive look and feel across different use cases.

On this page
  1. Components
    1. Usage
      1. Component Details
        1. EmptyState
        2. EmptyStateHeading
        3. EmptyStateText
        4. EmptyStateButton
      2. Features
        1. Customization