ZUI

Search documentation

Find a page or a heading.

Empty

A centred placeholder for a screen or section with nothing to show yet.

Installation

bash

The CLI writes components/ui/empty.tsx, installs Text, Icon and Utils, and adds class-variance-authority.

Usage

tsx
tsx

The Empty's border is dashed but has no width; add border border-border to draw it, as the demo does. A device has no base border colour, so a border class you add names its colour too.

API reference

Empty

Takes every prop of React Native's View. It centres its children, and every Text inside is centred.

EmptyHeader, EmptyContent

Each takes every prop of React Native's View. EmptyHeader holds the media, title and description; EmptyContent holds actions.

EmptyMedia

Takes every prop of React Native's View, plus:

default draws its child as it is, such as an image. icon draws an Icon child on a muted tile, at 24px in Vega and 16px in Nova.

EmptyTitle, EmptyDescription

Each takes every prop of Text. EmptyDescription is muted.

Differences from upstream

  • Upstream's Empty grows to fill its parent with flex-1. Inside a scroll view, which is where most native screens put it, that collapses the box, so the native Empty takes its content's height. Add flex-1 to fill a parent with a height of its own.
  • Upstream underlines a link inside the description. React Native has no nested link element to select, so style a pressable Text inside it yourself.