Build faster with Premium Chakra UI Components 💎

Learn more
Skip to Content
DocsPlaygroundGuidesBlog
Sponsor

Empty State

Used to indicate when a resource is empty or unavailable.

SourceStorybookRecipe

Your cart is empty

Explore our products and add items to your cart

Usage

import { EmptyState } from "@chakra-ui/react"
<EmptyState.Root>
  <EmptyState.Content>
    <EmptyState.Indicator />
    <EmptyState.Title />
    <EmptyState.Description />
  </EmptyState.Content>
</EmptyState.Root>

Examples

Sizes

Use the size prop to set the size of the Empty state.

Your cart is empty

Explore our products and add items to your cart

Your cart is empty

Explore our products and add items to your cart

Your cart is empty

Explore our products and add items to your cart

Action

Here's an example of an empty state with an action button.

Start adding tokens

Add a new design token to get started

List

Here's an example of an empty state with a list.

No results found

Try adjusting your search

  • Try removing filters
  • Try different keywords

Closed Component

Here's how to setup the Empty State for a closed component composition.

import { EmptyState as ChakraEmptyState, VStack } from "@chakra-ui/react"
import * as React from "react"

export interface EmptyStateProps extends ChakraEmptyState.RootProps {
  title: string
  description?: string
  icon?: React.ReactNode
}

export const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
  function EmptyState(props, ref) {
    const { title, description, icon, children, ...rest } = props
    return (
      <ChakraEmptyState.Root ref={ref} {...rest}>
        <ChakraEmptyState.Content>
          {icon && (
            <ChakraEmptyState.Indicator>{icon}</ChakraEmptyState.Indicator>
          )}
          {description ? (
            <VStack textAlign="center">
              <ChakraEmptyState.Title>{title}</ChakraEmptyState.Title>
              <ChakraEmptyState.Description>
                {description}
              </ChakraEmptyState.Description>
            </VStack>
          ) : (
            <ChakraEmptyState.Title>{title}</ChakraEmptyState.Title>
          )}
          {children}
        </ChakraEmptyState.Content>
      </ChakraEmptyState.Root>
    )
  },
)

Props

Root

PropDefaultType
colorPalette 'gray'
'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink' | 'accent'

The color palette of the component

size 'md'
'md' | 'lg'

The size of the component

Previous

Editable

Next

Field