Empty State

Display

A centred layout for empty lists or zero-data screens. Combines an icon, title, description, and an optional call-to-action.

GitHub

Installation

bash
1
npx native-mate add empty-state

Examples

#FAFAFA
Radius100%

Usage

tsx
1
2
3
4
5
6
7
8
9
import { EmptyState } from '~/components/ui/empty-state'
import { InboxIcon } from 'lucide-react-native'

<EmptyState
  icon={<InboxIcon size={48} color="#71717a" />}
  title="No messages yet"
  description="When you receive messages they will appear here."
  action={{ label: 'Compose message', onPress: handleCompose }}
/>

Props

PropTypeDefaultDescription
iconReact.ReactNodeIllustration or icon displayed at the top.
titlestringPrimary heading text.
descriptionstringSecondary body text explaining the empty state.
action{ label: string; onPress: () => void }Optional call-to-action button configuration.

Example

tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { EmptyState } from '~/components/ui/empty-state'
import { SearchX } from 'lucide-react-native'
import { View } from 'react-native'
import { useRouter } from 'expo-router'

export function EmptyStateExample() {
  const router = useRouter()

  return (
    <View style={{ flex: 1, justifyContent: 'center', padding: 32 }}>
      <EmptyState
        icon={<SearchX size={56} color="#52525b" />}
        title="No results found"
        description="We couldn't find anything matching your search. Try adjusting your filters or search term."
        action={{ label: 'Clear filters', onPress: () => router.setParams({ q: '' }) }}
      />
    </View>
  )
}