@molecule/app-activity-feed-vue

Feature · activity-feed · App (browser) · v1.1.0 · Apache-2.0

Vue activity feed rows and date-grouped feed container

npm install @molecule/app-activity-feed-vue

npm · Source on GitHub

How it works

@molecule/app-activity-feed-vue is a ready-made activity-feed 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 { ActivityFeed, ActivityFeedGroup } from '@molecule/app-activity-feed-vue'

const items = [
  { id: '1', actor: 'Alice', verb: 'commented on', target: 'PR #42', timestamp: '2m ago' },
  { id: '2', actor: 'Bob', verb: 'closed', target: 'Issue #7', timestamp: '1h ago' },
]

const Feed = defineComponent({
  setup() {
    return () =>
      h('div', [
        // Flat feed
        h(ActivityFeed, { items }, { emptyState: () => [h('p', 'No activity yet.')] }),
        // Grouped by date
        h(ActivityFeedGroup, { heading: 'Today', items }),
      ])
  },
})

createApp(Feed).mount('#app')

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

Reference

Vue activity-feed primitives — the Vue counterpart of @molecule/app-activity-feed-react: the same props (React names) and the same DOM for the same input.

Exports:

  • <ActivityFeed> — flat vertical list of activity rows.
  • <ActivityFeedItem> — single row (avatar + actor/verb/target + timestamp + body).
  • <ActivityFeedGroup> — heading + list, compose multiple for "Today / Yesterday" feeds.
  • ActivityFeedItemData type for row data.

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 { createApp, defineComponent, h } from 'vue'
import { ActivityFeed, ActivityFeedGroup } from '@molecule/app-activity-feed-vue'

const items = [
  { id: '1', actor: 'Alice', verb: 'commented on', target: 'PR #42', timestamp: '2m ago' },
  { id: '2', actor: 'Bob', verb: 'closed', target: 'Issue #7', timestamp: '1h ago' },
]

const Feed = defineComponent({
  setup() {
    return () =>
      h('div', [
        // Flat feed
        h(ActivityFeed, { items }, { emptyState: () => [h('p', 'No activity yet.')] }),
        // Grouped by date
        h(ActivityFeedGroup, { heading: 'Today', items }),
      ])
  },
})

createApp(Feed).mount('#app')

Type

feature

Installation

npm install @molecule/app-activity-feed-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue

API

Interfaces

ActivityFeedItemData

Per-row activity data.

interface ActivityFeedItemData {
  /** Row id (the render key). */
  id: string
  /** Actor avatar source URL. */
  avatarSrc?: string
  /** Actor display name. */
  actor: VNodeChild
  /** Verb describing the action ("commented on", "assigned", "completed"). */
  verb: VNodeChild
  /** Object of the action ("the ticket", "Project Alpha", etc.). */
  target?: VNodeChild
  /** Optional supporting body (quote, diff, preview). */
  body?: VNodeChild
  /** ISO timestamp or any node to render as "time ago". */
  timestamp: VNodeChild
  /** Optional leading icon (replaces avatar when present). */
  icon?: VNodeChild
}

ActivityFeedProps

Props accepted by the ActivityFeed component.

interface ActivityFeedProps {
  /** Items in display order (usually most-recent first). */
  items: ActivityFeedItemData[]
  /** Rendered when `items` is empty — passed as a prop or as the same-named slot. */
  emptyState?: VNodeChild
  /** Optional footer (e.g. "Load more") — passed as a prop or as the same-named slot. */
  footer?: VNodeChild
  /** Extra classes. */
  className?: string
}

ActivityFeedItemProps

Props accepted by the ActivityFeedItem component.

interface ActivityFeedItemProps {
  /** The row to render. */
  item: ActivityFeedItemData
  /** Extra classes on the row wrapper. */
  className?: string
}

ActivityFeedGroupProps

Props accepted by the ActivityFeedGroup component.

interface ActivityFeedGroupProps {
  /**
   * Group heading — typically a formatted date ("Today", "Yesterday", "Mar 12").
   * Passed as a prop or as the same-named slot.
   */
  heading: VNodeChild
  /** Items in this group. */
  items: ActivityFeedItemData[]
  /** Extra classes. */
  className?: string
}

Constants

ActivityFeed

Simple activity feed — renders each item via <ActivityFeedItem> and stacks them. With no items and an empty state, React renders the empty state alone; for date-grouped feeds use <ActivityFeedGroup>.

const ActivityFeed: DefineComponent<
  ExtractPropTypes<{
    items: { type: PropType<ActivityFeedItemData[]>; required: true }
    emptyState: null
    footer: null
    className: { type: StringConstructor; default: undefined }
  }>,
  () => VNode,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      items: { type: PropType<ActivityFeedItemData[]>; required: true }
      emptyState: null
      footer: null
      className: { type: StringConstructor; default: undefined }
    }>
  > &
    Readonly<{}>,
  { className: string },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see ActivityFeedProps).

Returns: The activity feed component.

ActivityFeedGroup

Date-grouped activity section — a heading followed by a stack of items. Compose multiple groups together for an organized "Today / Yesterday / Last week" feed.

const ActivityFeedGroup: DefineComponent<
  ExtractPropTypes<{
    heading: null
    items: { type: PropType<ActivityFeedItemData[]>; required: true }
    className: { type: StringConstructor; default: undefined }
  }>,
  () => VNode,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      heading: null
      items: { type: PropType<ActivityFeedItemData[]>; required: true }
      className: { type: StringConstructor; default: undefined }
    }>
  > &
    Readonly<{}>,
  { className: string },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see ActivityFeedGroupProps).

Returns: The activity group component.

ActivityFeedItem

One entry in an activity feed.

Shape: [avatar|icon] [actor verb target · timestamp] [body]. The leading column renders the item's icon when supplied, otherwise an <Avatar> for avatarSrc, otherwise nothing — React's icon ?? (avatarSrc ? … : null).

const ActivityFeedItem: DefineComponent<
  ExtractPropTypes<{
    item: { type: PropType<ActivityFeedItemData>; required: true }
    className: { type: StringConstructor; default: undefined }
  }>,
  () => VNode,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      item: { type: PropType<ActivityFeedItemData>; required: true }
      className: { type: StringConstructor; default: undefined }
    }>
  > &
    Readonly<{}>,
  { className: string },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see ActivityFeedItemProps).

Returns: The activity row component.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-vue ^1.1.0
  • @molecule/app-vue ^3.5.0
  • vue ^3.4.0

Runtime Dependencies

  • @molecule/app-ui

  • @molecule/app-ui-vue

  • @molecule/app-vue

  • vue

  • Requires a bonded ClassMap (getClassMap()); rendering throws otherwise.

  • Node-valued props (emptyState, footer, heading) arrive as a prop AND a same-named slot — the component accepts either, the slot winning.

  • Rows are keyed by their id, so a re-passed or re-ordered list keeps each row's DOM the way React's key does.