Skip to content

← All components

Display and feedback

EmptyState

Concise no-data explanation and next action.

Live example

No posts yet

Publish the first note when it is ready.

Usage

Each example includes the complete adapter-specific parameter reference. Copy it as a starting point, then remove options your use case does not need.

React

tsx
import { EmptyState } from "@cofob/design-system-react";

/**
 * Complete EmptyState parameter reference.
 * @param title
 *   type: string | renderable content
 *   default: —
 *   example: "No posts yet"
 * @param description
 *   type: string | renderable content
 *   default: —
 *   example: "Publish your first note to get started."
 * @param icon
 *   type: LucideIcon (React) | Snippet (Svelte)
 *   default: —
 *   example: Inbox / icon snippet
 * @param action
 *   type: renderable content
 *   default: —
 *   example: <Button>Create a post</Button>
 * @param children
 *   type: ReactNode | Svelte Snippet | child HTML
 *   default: —
 *   example: children / snippet / child HTML
 * @param div attributes
 *   type: native element attributes
 *   default: —
 *   example: class / style / aria-* / data-*
 */
export function EmptyStateExample() {
  return (
    <EmptyState title="No posts" />
  );
}

Svelte

svelte
<script lang="ts">
  import { EmptyState } from "@cofob/design-system-svelte";

  // Complete EmptyState parameter reference.
  // title
  //   type: string | renderable content
  //   default: —
  //   example: "No posts yet"
  // description
  //   type: string | renderable content
  //   default: —
  //   example: "Publish your first note to get started."
  // icon
  //   type: LucideIcon (React) | Snippet (Svelte)
  //   default: —
  //   example: Inbox / icon snippet
  // action
  //   type: renderable content
  //   default: —
  //   example: <Button>Create a post</Button>
  // children
  //   type: ReactNode | Svelte Snippet | child HTML
  //   default: —
  //   example: children / snippet / child HTML
  // div attributes
  //   type: native element attributes
  //   default: —
  //   example: class / style / aria-* / data-*
</script>

<EmptyState title="No posts" />

HTML

html
<!--
  Complete EmptyState parameter reference.
  title
    type: string | renderable content
    default: —
    example: "No posts yet"
  description
    type: string | renderable content
    default: —
    example: "Publish your first note to get started."
  icon
    type: LucideIcon (React) | Snippet (Svelte)
    default: —
    example: Inbox / icon snippet
  action
    type: renderable content
    default: —
    example: <Button>Create a post</Button>
  children
    type: ReactNode | Svelte Snippet | child HTML
    default: —
    example: children / snippet / child HTML
  div attributes
    type: native element attributes
    default: —
    example: class / style / aria-* / data-*
-->
<div class="cf-empty-state">No posts yet</div>

Parameters

Adapter differences are explicit. Native element attributes are forwarded in React and Svelte and can be written directly in HTML.

ParameterTypeDefaultAdaptersExampleDescription
titlestring | renderable contentReact · Svelte · HTML"No posts yet"Primary heading or accessible title.
descriptionstring | renderable contentReact · Svelte · HTML"Publish your first note to get started."Supporting explanatory content.
iconLucideIcon (React) | Snippet (Svelte)React · Svelte · HTMLInbox / icon snippetOverrides the default semantic icon.
actionrenderable contentReact · Svelte · HTML<Button>Create a post</Button>Optional next action rendered in the empty state.
childrenReactNode | Svelte Snippet | child HTMLReact · Svelte · HTMLchildren / snippet / child HTMLIdiomatic adapter composition content.
div attributesnative element attributesReact · Svelte · HTMLclass / style / aria-* / data-*Forwards native class/style, accessibility, event, and data attributes to the root element.