EmptyState

Explains an empty screen and offers the next step.

  • Composed
  • New in 0.1
import { EmptyState, emptyStatePrimitive } from "nitro-ui-sdk/empty-state";
HeroUI Native
EmptyState (Pro)
Expo UI
No counterpart
  • EmptyState example screen, light appearance
    Light
  • EmptyState example screen, dark appearance
    Dark
On this page

EmptyState explains a screen that has nothing to show yet, and offers the next action. It is centered: an icon in a soft tile, a title, a description, and optional primary and secondary actions.

Use it for an empty library or an empty inbox. For a loading library, use Skeleton. For a failure that is not emptiness, use Alert.

Anatomy

<EmptyState.Root title="No albums yet" description="Albums you add show up here.">
  <EmptyState.Icon />
  <EmptyState.Title />
  <EmptyState.Description />
  <EmptyState.Actions>
    <EmptyState.Primary />
    <EmptyState.Secondary />
  </EmptyState.Actions>
</EmptyState.Root>
Part Description
Root Centers the block and registers the agent entry.
Icon SF Symbol inside a soft tile.
Title The heading.
Description The sentence under the title. Wrapped to a comfortable width.
Actions Row for the buttons.
Primary Slot for the main action.
Secondary Slot for the quieter action.

Pass primary and secondary on the root to fill those slots without writing the parts.

Usage

import { Button } from "nitro-ui-sdk/button";
import { EmptyState } from "nitro-ui-sdk/empty-state";

export function NoAlbums() {
  return (
    <EmptyState.Root
      title="No albums yet"
      description="Albums you add on this device show up here."
      symbol="square.stack"
      primary={<Button.Root label="Add album" onPress={() => undefined} />}
      secondary={<Button.Root label="Import" variant="secondary" onPress={() => undefined} />}
    />
  );
}

Variants and sizes

The only variant is plain. size is regular (default) or compact. Regular uses a 72 point tile and a larger title. Compact uses a 48 point tile and tighter type, for a section rather than a whole screen.

<EmptyState.Root title="No messages" description="New messages land here." size="compact" />

States

EmptyState is not busy, invalid, or disabled. The actions you pass bring their own pressed and disabled states. There is nothing to dismiss.

Controlled

There is no value. size, copy, and actions all come from the parent.

const [size, setSize] = useState<"compact" | "regular">("regular");

<EmptyState.Root title="No albums yet" size={size} />

Liquid Glass

EmptyState does not draw Liquid Glass. The icon tile uses the opaque accent soft color.

Props

Root

Prop Type Default Description
title string — Heading and accessible name. Required.
description string — Sentence under the title.
symbol string "tray" SF Symbol drawn in the tile.
size "compact" | "regular" "regular" Tile, icon, and type scale.
primary ReactNode — Main action.
secondary ReactNode — Second action.
styles EmptyStyles — Per-part style resolvers.
api Controller<EmptyStateActions> — Attached controller.
agentId string — Stable agent id.
layout layout — Extra layout merged onto the root.

Controller API

import { emptyStatePrimitive } from "nitro-ui-sdk/empty-state";

const api = emptyStatePrimitive.createApi();
api.current?.getState();
Action Signature Result
getState () => EmptyStateState The current size.

Styles

The resolver receives tokens, variant ("plain"), size, and state.

<EmptyState.Root
  title="No albums yet"
  styles={{
    icon: ({ tokens }) => ({
      style: { background: tokens.colors.accentSoft },
      text: { color: tokens.colors.accentSoftForeground },
    }),
    title: ({ tokens }) => ({ text: { color: tokens.colors.foreground } }),
  }}
/>

Accessibility

The root is a group, so the title, the description, and the buttons stay separate elements. The title is a heading. The icon is decorative. Buttons keep the labels you give them.

Agent API

Read-only. Role text. The name is the title and the text is the description. Actions on the buttons register as their own controls.

Platform notes

iOS Android
Drawing Composed. The tile icon is an SF Symbol. Composed. Off iOS the tile draws a text glyph, ∅ for tray and • otherwise.
Verification Exercised by the iOS harness on the lanes simulator. No Kotlin was added for this family.