suiss/uim · React Native Component

Empty

A centered placeholder for screens and lists that have no content yet.

Empty is an open-source mobile component from suiss/uim for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Empty on iOS in light mode

Empty is a centered column that fills the available space and holds an EmptyHeader with optional EmptyMedia, an EmptyTitle and an EmptyDescription, followed by EmptyContent for actions. Text is centered and the header and content are limited to a readable width.

Use it for empty lists, search results with no matches and first-run screens.

Installation

$ pnpm dlx @esuiss/uim@latest add empty

The CLI also adds what it builds on: Icon, Text.

Manual

  1. Install the dependencies:
npx expo install class-variance-authority cn
  1. Add the pieces it builds on: Icon, Text.

  2. Copy the source into components/ui/empty.tsx:

uniwind/components/ui/empty.tsx
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
import { View, type ViewProps } from "react-native"
import { IconClassContext } from "@/components/ui/icon"
import { Text, TextClassContext } from "@/components/ui/text"

function Empty({ className, ...props }: ViewProps) {
  return (
    <TextClassContext.Provider value="text-center">
      <View
        className={cn(
          "w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-2xl p-12",
          className
        )}
        {...props}
      />
  1. Update the import paths to match your project.

Usage

import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent } from "@/components/ui/empty"
<Empty>
  <EmptyHeader>
    <EmptyMedia variant="icon">
      <Icon as={FolderOpenIcon} />
    </EmptyMedia>
    <EmptyTitle>No projects yet</EmptyTitle>
    <EmptyDescription>
      You haven't created any projects yet. Get started by creating your
      first project.
    </EmptyDescription>
  </EmptyHeader>
  <EmptyContent>
    <Button>
      <Text>Create project</Text>
    </Button>
    <Button variant="link">
      <Text>Import project</Text>
    </Button>
  </EmptyContent>
</Empty>

EmptyMedia has two variants: default shows its child as is, such as an illustration, and icon puts an Icon in a small rounded tile. Put buttons or links in EmptyContent.

Add a background class such as bg-surface-secondary to Empty for a filled panel.

Examples

Muted

A filled panel with only a title and description.

iOS
Empty (muted) on iOS in light mode

API Reference

Empty

Centered container.

ExtendsViewProps

EmptyHeader

Column for media, title and description.

ExtendsViewProps

EmptyMedia

Decorative icon or illustration.

ExtendsViewProps
PropType
About
default or icon.
Type
"default""icon"
Default
"default"

EmptyTitle

Heading.

ExtendsReact.ComponentProps<typeof Text>

EmptyDescription

Supporting text.

ExtendsReact.ComponentProps<typeof Text>

EmptyContent

Area for actions.

ExtendsViewProps

Accessibility

  • EmptyTitle has the heading role.
  • EmptyMedia is hidden from screen readers, so the title and description must carry the message.

Notes

  • Uses bg-surface-secondary, text-label and text-label-secondary tokens; light and dark follow the system appearance.