Blocks · engine.empty-state · version 0.1.0

Empty State

Says that a view has nothing to show yet, and offers the action that fills it.

Preview

Every variant in every state, drawn by the same definition that the Figma sync and the tests use.

emptyState in every size and state
sizerest
sm
No items yetItems you create appear here.
md
No items yetItems you create appear here.

Install

npx @uiuxengine/cli add empty-state

The CLI copies the block's files into src/blocks/empty-state/ and records them in engine.lock.json. The files are yours to edit; upgrade keeps your edits. See Blocks and the CLI.

Usage

import { EmptyState } from "./blocks/empty-state/empty-state.tsx";
import { Button } from "@uiuxengine/react";
import { IconInbox } from "@uiuxicons/react/icons/inbox";

export function Example() {
  return (
    <EmptyState
      title="No items yet"
      description="Items you create appear here."
      icon={IconInbox}
      action={<Button variant="primary" label="Create item" />}
    />
  );
}

Guidelines

  • Use it in place of a list, table or result that is empty, not for errors or loading.
  • The title says what is missing, for example 'No reports yet'. The description says why, or what to do next.
  • Offer at most one action: the one that fills the view, as a primary button.
  • Use size sm inside panels, table cells and sidebars, and md for a whole page or view.

Props

PropTypeDefaultDescription
size"sm" | "md"mdsm for panels and other small areas, md for a whole view.
title requiredtext, up to 60—What is missing.
descriptiontext, up to 240—Why the view is empty or what to do next. Wraps to the block's width.

Slots

SlotTakesDescription
iconiconAn icon for what is missing.
actionengine.buttonThe action that fills the view.

Accessibility

  • Renders a native <div> with the role generic.

As a spec

Agents describe interfaces as JSON specs. A spec renders only after it validates against the installed contracts, the approved icons and the host's actions. Edit it to see.

No items yetItems you create appear here.

No actions yet.

JSON Schema of the props
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:uiuxengine:component:engine.empty-state@0.1.0",
  "title": "emptyState",
  "description": "Says that a view has nothing to show yet, and offers the action that fills it.",
  "type": "object",
  "properties": {
    "size": {
      "description": "sm for panels and other small areas, md for a whole view.",
      "type": "string",
      "enum": [
        "sm",
        "md"
      ],
      "default": "md"
    },
    "title": {
      "description": "What is missing.",
      "type": "string",
      "maxLength": 60
    },
    "description": {
      "description": "Why the view is empty or what to do next. Wraps to the block's width.",
      "type": "string",
      "maxLength": 240
    },
    "icon": {
      "$ref": "#/$defs/iconRef",
      "description": "An icon for what is missing."
    },
    "action": {
      "description": "The action that fills the view.",
      "type": "object",
      "properties": {
        "component": {
          "enum": [
            "engine.button"
          ]
        },
        "props": {
          "type": "object"
        }
      },
      "required": [
        "component"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "title"
  ],
  "additionalProperties": false,
  "$defs": {
    "iconRef": {
      "type": "object",
      "description": "A reference to an icon in the host's approved catalog.",
      "properties": {
        "type": {
          "const": "icon"
        },
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "style": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "weight": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
        }
      },
      "required": [
        "type",
        "id"
      ],
      "additionalProperties": false
    }
  }
}

Registry item

Files
src/blocks/empty-state/empty-state.contract.tssrc/blocks/empty-state/empty-state.design.tssrc/blocks/empty-state/empty-state.tsx
Packages it imports
@uiuxengine/core @uiuxengine/react @uiuxengine/tokens react
Engine
^0.4.0
License
MIT, free
Item
/r/empty-state.json, in item format 2