@molecule/app-empty-state-solid

Feature · empty-state · App (browser) · v1.1.2 · Apache-2.0

Solid empty-state and CTA-card primitives

npm install @molecule/app-empty-state-solid

npm · Source on GitHub

How it works

@molecule/app-empty-state-solid is a ready-made empty-state feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.

import { CtaCard, EmptyState } from '@molecule/app-empty-state-solid'
import { Button, Icon } from '@molecule/app-ui-solid'

// Centred empty-state for a list with no items
<EmptyState
  icon={<Icon name="mail" size={40} />}
  title={t('messages.empty.title', {}, { defaultValue: 'No messages yet' })}
  description={t('messages.empty.description', {}, { defaultValue: 'When you receive messages they will appear here.' })}
  action={<Button onClick={() => openCompose()}>Send one</Button>}
/>

// Inline promotional card
<CtaCard
  title="Connect your bank"
  description="Link an account to start tracking transactions."
  action={<Button variant="solid">Connect</Button>}
/>

Works with: @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid

Reference

Solid empty-state and CTA-card primitives.

Exports:

  • EmptyState — centred icon + title + description + action for lists, feeds, boards, or tables that have no rows to render yet.
  • CtaCard — horizontal or vertical promotional card for "next-step" actions inside a page body.

Both components accept a className prop so apps can layer per-brand accent chrome (dashed borders, gradient CTAs, tinted backgrounds) on top of the structural layout.

A selected list view passes view={emptyByView[selection]}. Each entry pairs its translated title, optional description, and required action element. Keep those entries beside the view definitions so a personal or filtered list does not reuse the whole collection's empty message. The action can be a router link to another view or a button that clears filters. General empty states keep the existing title and optional action props.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

import { CtaCard, EmptyState } from '@molecule/app-empty-state-solid'
import { Button, Icon } from '@molecule/app-ui-solid'

// Centred empty-state for a list with no items
<EmptyState
  icon={<Icon name="mail" size={40} />}
  title={t('messages.empty.title', {}, { defaultValue: 'No messages yet' })}
  description={t('messages.empty.description', {}, { defaultValue: 'When you receive messages they will appear here.' })}
  action={<Button onClick={() => openCompose()}>Send one</Button>}
/>

// Inline promotional card
<CtaCard
  title="Connect your bank"
  description="Link an account to start tracking transactions."
  action={<Button variant="solid">Connect</Button>}
/>

Type

feature

Installation

npm install @molecule/app-empty-state-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js

API

Interfaces

EmptyStateProps

Props accepted by the EmptyState component.

interface EmptyStateProps {
  /** Visual — typically an `<Icon>` or `<img>`. Rendered in a circular badge above the heading. */
  icon?: JSX.Element
  /** Primary heading for a general, unselected collection. */
  title: JSX.Element
  /** Supporting description shown below the heading. */
  description?: JSX.Element
  /** Optional action for a general empty state. */
  action?: JSX.Element
  /** Selected views use the component's view-owned props instead. */
  view?: never
  /** `data-mol-id` for AI-agent selectors. */
  dataMolId?: string
  /** Override outer wrapper classes (for per-app dashed-border, background, padding, etc.). */
  className?: string
  /** Override the icon-badge wrapper classes. */
  iconWrapperClassName?: string
}

CtaCardProps

Props accepted by the CtaCard component.

interface CtaCardProps {
  /** Optional small eyebrow line above the title. */
  eyebrow?: JSX.Element
  /** Primary heading. */
  title: JSX.Element
  /** Supporting copy. */
  description?: JSX.Element
  /** Primary call-to-action. */
  action?: JSX.Element
  /** Optional visual / illustration rendered at the top or side. */
  media?: JSX.Element
  /** `'horizontal'` renders media beside text; `'vertical'` stacks them. Defaults to `'vertical'`. */
  layout?: 'vertical' | 'horizontal'
  /** `data-mol-id` for AI-agent selectors. */
  dataMolId?: string
  /** Override outer wrapper classes. */
  className?: string
}

Functions

CtaCard(props)

A "soft sell" card used to promote a next-step action inside a page body (e.g., "Connect your bank", "Invite teammates").

Differs from <EmptyState> in being positioned in a list of cards rather than filling the void. Supports a horizontal layout with the media slot beside the text.

This is the Solid counterpart of @molecule/app-empty-state-react's CtaCard: the same props (React names), the same ClassMap tokens, and the same DOM for the same input.

function CtaCard(props: CtaCardProps): JSX.Element
  • props — Component props (see CtaCardProps).

Returns: The rendered CTA card.

EmptyState(props)

Generic centred empty-state panel for lists, feeds, boards, and tables.

Renders a vertical stack of [icon, title, description, action]. Typography and spacing come from the wired ClassMap; per-app accent chrome (dashed borders, tinted backgrounds, gradient CTAs) is passed via className on the outer element.

This is the Solid counterpart of @molecule/app-empty-state-react's EmptyState: the same props (React names), the same ClassMap tokens, and the same DOM for the same input.

function EmptyState(props: EmptyStateProps | SelectedViewEmptyStateProps): JSX.Element
  • props — Component props (see EmptyStateProps).

Returns: The rendered empty state.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-solid ^3.14.0 || ^4.0.0
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-solid ^1.1.0
  • solid-js ^1.8.0

Runtime Dependencies

  • @molecule/app-solid

  • @molecule/app-ui

  • @molecule/app-ui-solid

  • solid-js

  • Name collision: @molecule/app-ui-solid also exports an EmptyState (the ClassMap-token variant driven by cm.emptyState*). Use THAT one for plain framework-styled empty states; use THIS package when you want the circular icon badge (iconWrapperClassName), per-brand chrome via className, a dataMolId, or the companion <CtaCard>. If you import both packages, alias one import to avoid the clash.

  • All text arrives via props — translate with your t() calls; this package has no locale bond of its own.

  • Styling resolves through getClassMap() — requires a wired ClassMap bond (standard molecule app setup).