@molecule/app-empty-state-vue
Feature · empty-state · App (browser) · v1.1.2 · Apache-2.0
Vue empty-state and CTA-card primitives
npm install @molecule/app-empty-state-vueHow it works
@molecule/app-empty-state-vue 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 { createApp, defineComponent, h } from 'vue'
import { CtaCard, EmptyState } from '@molecule/app-empty-state-vue'
import { Button, Icon } from '@molecule/app-ui-vue'
const MessagesEmpty = defineComponent({
setup() {
return () =>
h(
EmptyState,
{ title: t('messages.empty.title', {}, { defaultValue: 'No messages yet' }) },
{
icon: () => [h(Icon, { name: 'mail', size: 40 })],
description: () => [
t(
'messages.empty.description',
{},
{
defaultValue: 'When you receive messages they will appear here.',
},
),
],
action: () => [h(Button, { onClick: () => openCompose() }, () => 'Send one')],
},
)
},
})
createApp(MessagesEmpty).mount('#app')Works with: @molecule/app-ui, @molecule/app-ui-vue, @molecule/app-vue
Reference
Vue 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.tsJSDoc, not this file.
Quick Start
import { createApp, defineComponent, h } from 'vue'
import { CtaCard, EmptyState } from '@molecule/app-empty-state-vue'
import { Button, Icon } from '@molecule/app-ui-vue'
const MessagesEmpty = defineComponent({
setup() {
return () =>
h(
EmptyState,
{ title: t('messages.empty.title', {}, { defaultValue: 'No messages yet' }) },
{
icon: () => [h(Icon, { name: 'mail', size: 40 })],
description: () => [
t(
'messages.empty.description',
{},
{
defaultValue: 'When you receive messages they will appear here.',
},
),
],
action: () => [h(Button, { onClick: () => openCompose() }, () => 'Send one')],
},
)
},
})
createApp(MessagesEmpty).mount('#app')
Type
feature
Installation
npm install @molecule/app-empty-state-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue
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. Passed as a prop or as the same-named slot.
*/
icon?: VNodeChild
/** Primary heading for a general, unselected collection. */
title?: VNodeChild
/** Supporting description shown below the heading. */
description?: VNodeChild
/** Optional action for a general empty state. */
action?: VNodeChild
/**
* The selected view's translated message and required recovery element, kept
* together so a filtered or personal list never reuses the whole
* collection's empty message. Replaces `title`, `description` and `action`
* when given.
*/
view?: {
/** The selected view's translated heading. */
title: VNodeChild
/** The selected view's supporting description. */
description?: VNodeChild
/** The selected view's recovery element — a router link or a button. */
action: VNodeChild
}
/** `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?: VNodeChild
/** Primary heading. */
title?: VNodeChild
/** Supporting copy. */
description?: VNodeChild
/** Primary call-to-action. */
action?: VNodeChild
/** Optional visual / illustration rendered at the top or side. */
media?: VNodeChild
/** `'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
}
Constants
CtaCard
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. Node-valued props (eyebrow, title, description,
action, media) arrive as a prop or as the same-named slot.
const CtaCard: DefineComponent<
ExtractPropTypes<{
eyebrow: null
title: null
description: null
action: null
media: null
layout: { type: PropType<'vertical' | 'horizontal'>; default: string }
dataMolId: StringConstructor
className: StringConstructor
}>,
() => VNode,
{},
{},
{},
ComponentOptionsMixin,
ComponentOptionsMixin,
{},
string,
PublicProps,
Readonly<
ExtractPropTypes<{
eyebrow: null
title: null
description: null
action: null
media: null
layout: { type: PropType<'vertical' | 'horizontal'>; default: string }
dataMolId: StringConstructor
className: StringConstructor
}>
> &
Readonly<{}>,
{ layout: 'vertical' | 'horizontal' },
{},
{},
{},
string,
ComponentProvideOptions,
true,
{},
any
>
props— Component props (seeCtaCardProps).
Returns: The CTA-card component.
EmptyState
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. Node-valued props (icon, title, description, action)
arrive as a prop or as the same-named slot — both work.
const EmptyState: DefineComponent<
ExtractPropTypes<{
icon: null
title: null
description: null
action: null
view: PropType<SelectedView>
dataMolId: StringConstructor
className: StringConstructor
iconWrapperClassName: StringConstructor
}>,
() => VNode,
{},
{},
{},
ComponentOptionsMixin,
ComponentOptionsMixin,
{},
string,
PublicProps,
Readonly<
ExtractPropTypes<{
icon: null
title: null
description: null
action: null
view: PropType<SelectedView>
dataMolId: StringConstructor
className: StringConstructor
iconWrapperClassName: StringConstructor
}>
> &
Readonly<{}>,
{},
{},
{},
{},
string,
ComponentProvideOptions,
true,
{},
any
>
props— Component props (seeEmptyStateProps).
Returns: The empty-state component.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-ui^1.0.1@molecule/app-ui-vue^1.1.0@molecule/app-vue^3.13.0 || ^4.0.0vue^3.4.0
Runtime Dependencies
-
@molecule/app-ui -
@molecule/app-ui-vue -
@molecule/app-vue -
vue -
Name collision:
@molecule/app-ui-vuealso exports anEmptyState(the ClassMap-token variant driven bycm.emptyState*). Use THAT one for plain framework-styled empty states; use THIS package when you want the circular icon badge (iconWrapperClassName), per-brand chrome viaclassName, adataMolId, 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). -
Node-valued props (
icon,title,description,action,eyebrow,media) arrive as props or as same-named slots; components accept either.