tapcn
Components

EmptyState

A placeholder component for empty screens and lists.

No messages yetWhen you receive messages, they'll appear here
Compose Message

EmptyState

A centered placeholder view for screens or lists with no content. Displays an optional icon, a title, an optional description, and an optional action button.

Installation

npx @tapcn/cli add empty-state

Or using shadcn directly:

npx shadcn@latest add https://tapcn.vercel.app/r/empty-state.json

Usage

import { EmptyState } from '~/components/ui/empty-state';
import { Icon } from '~/components/ui/icon';
import { Inbox } from 'lucide-react-native';
import { Button } from '~/components/ui/button';
import { Text } from '~/components/ui/text';

export function EmptyStateExample() {
  return (
    <EmptyState
      icon={<Icon as={Inbox} className="text-muted-foreground size-8" />}
      title="No messages"
      description="You don't have any messages yet. Start a conversation!"
      action={
        <Button onPress={() => console.log('pressed')}>
          <Text>New Message</Text>
        </Button>
      }
    />
  );
}

Minimal usage

<EmptyState title="Nothing here yet" />

Props

PropTypeDefaultDescription
iconReact.ReactNode-An optional icon displayed above the title inside a rounded muted circle.
titlestringrequiredThe primary heading text.
descriptionstring-An optional secondary description shown below the title.
actionReact.ReactNode-An optional action element (e.g. a Button) displayed below the description.
classNamestring-Additional NativeWind classes for the outer container.

Dependencies

No additional dependencies.

On this page