SwipeUI

Empty state

Intrinsic illustration, message and next-action layout.

npx @swipeui/cli add empty-state
Variant
Preset
Material
Scheme
Feel
Real free component with a browser animation bridge. Native motion, haptics and materials need a device.

When to use it

  • Empty lists, such as no messages yet or no saved items, with a way forward.
  • Search with no results and a suggestion to change filters.
  • First-run screens before people create anything.
  • Error-free blank states that need a friendly illustration.

When not to use it

  • Loading. Use Skeleton or Spinner.
  • Errors with retry. Use Alert.
  • Onboarding with several steps. Use Onboarding checklist.

Installation

Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.

npx @swipeui/cli add empty-state
  • Adds components/swipeui/ui/empty-state.tsx and 11 shared helpers.
  • Installs react-native-reanimated, react-native-worklets, uniwind, clsx, tailwind-merge, expo-haptics, class-variance-authority, react-native-svg. In Expo apps it uses npx expo install so versions match your SDK.

Usage

app/saved.tsx
import { EmptyState } from '@/components/swipeui/ui/empty-state';

<EmptyState title="No saved places" description="Save a place to find it here." />;

Examples

Use the variant and appearance controls in the live specimen to compare the documented states. The application owns validation, operation results and persistence.

API reference

EmptyStateProps

PropTypeDefaultDescription
preset?union—
title?string—
appearance?"elevated" | "transparent"'elevated'

Card or transparent composition.

person?Pick<AvatarProps, "name" | "source">undefined

Person used by the offline preset; the caller owns the image.

description?string | null—

Helpful next-step instructions.

illustration?ReactNode—

Decorative illustration; keep important meaning in the text.

action?{ label: string; onPress: () => void; }—

Primary next step.

secondaryAction?{ label: string; onPress: () => void; }—

Optional secondary route.

motion?MotionOverride—

Shared fade/press feel.

haptics?booleantrue

Action haptics.

className?string—

Root classes.

style?StyleProp<ViewStyle>—

Native layout escape hatch.

testID?string—

Root ID.

Native view/input props not listed here pass through where the exported TypeScript type allows them.

Composition and behavior

  • illustration, title and description stacked in the centre.
  • action and secondaryAction add a main and a ghost button.

Feedback lineup settings

PropDoes / default
appearanceCard or transparent composition. @default 'elevated'
personPerson used by the offline preset; the caller owns the image. @default undefined
descriptionHelpful next-step instructions.
illustrationDecorative illustration; keep important meaning in the text.
actionPrimary next step.
secondaryActionOptional secondary route.
motionShared fade/press feel.
classNameRoot classes.
styleNative layout escape hatch.
testIDRoot ID.

Ready-made states

Choose preset="offline-user", no-teammates, no-matches, empty-inbox, no-files or load-failed. Override title/description/art/actions, use appearance="transparent" to omit the card, or pass person={{ name, source }} for the offline avatar. Images belong to the host app.

Action haptics can be disabled independently with haptics={false} (default true).

Behavior and gestures

  • Shows a message with up to two buttons, such as Create your first note and Browse templates.
  • Buttons run their own actions; the illustration doesn't respond to touch.
  • It fades in gently with the layout role.

Accessibility

  • The illustration is decorative; put meaning in the title and description.
  • Action buttons are separate, named focus stops.
  • Text wraps fully at large sizes.

Motion

  • Uses the layout and press motion roles, so it follows your app's feel. Pass motion to tune this one instance.
  • Fades in with the layout role; Reduce Motion shows it immediately.

Performance

  • Mount it only when the list is really empty, not while loading.

Notes for AI

  • Write a title that says what's empty and a description with the next step.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items