Back to Onyx

EmptyMessageCard

web/lib/opal/src/components/cards/empty-message-card/README.md

4.6.0-cloud.01.9 KB
Original Source

EmptyMessageCard

Import: import { EmptyMessageCard, type EmptyMessageCardProps } from "@opal/components";

A pre-configured Card for empty states. Renders a transparent card with a dashed border containing a muted icon and message text using the Content layout.

Props

Base props (all presets)

PropTypeDefaultDescription
sizePreset"secondary" | "main-ui""secondary"Controls layout and text sizing
iconIconFunctionComponentSvgEmptyIcon displayed alongside the title
titlestring | RichStrPrimary message text (required)
padding0 | 0.5 | 1 | 2 | 4 | 64Padding, as a spacing step (N / 4 rem). Closed set.
refReact.Ref<HTMLDivElement>Ref forwarded to the root div

sizePreset="main-ui" only

PropTypeDefaultDescription
descriptionstring | RichStrOptional description text

description is not accepted when sizePreset is "secondary" (the default).

Usage

tsx
import { EmptyMessageCard } from "@opal/components";
import { SvgSparkle, SvgFileText, SvgActions } from "@opal/icons";

// Default empty state (secondary)
<EmptyMessageCard title="No items yet." />

// With custom icon
<EmptyMessageCard icon={SvgSparkle} title="No agents selected." />

// main-ui with description
<EmptyMessageCard
  sizePreset="main-ui"
  icon={SvgActions}
  title="No Actions Found"
  description="Provide OpenAPI schema to preview actions here."
/>

// Custom padding
<EmptyMessageCard padding={1} icon={SvgFileText} title="No documents available." />