@molecule/app-forum-thread-row-vue

Feature · forum-thread-row · App (browser) · v1.1.4 · Apache-2.0

Discussion / forum thread row with vote score, reply count, pin/lock badges, tags

npm install @molecule/app-forum-thread-row-vue

npm · Source on GitHub

How it works

@molecule/app-forum-thread-row-vue is a ready-made forum-thread-row 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 { ForumThreadRow } from '@molecule/app-forum-thread-row-vue'

const App = defineComponent({
  setup() {
    const thread = { id: 't1', title: 'How do I reset my password?' }
    const openThread = (): void => {
      // navigate to the thread…
    }
    return () =>
      h(ForumThreadRow, {
        title: thread.title,
        excerpt: 'I tried the forgot-password link but never received an email.',
        voteScore: 42,
        replyCount: 7,
        viewCount: 320,
        author: 'alice',
        createdAt: '2 hours ago',
        onClick: openThread,
      })
  },
})

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

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

Reference

Vue forum / discussion-board thread row.

Exports ForumThreadRow — title, optional excerpt, vote score, reply/view counts, pin/lock badges, author, timestamp, and an optional voteControls slot for inline up/down buttons. It is the Vue counterpart of @molecule/app-forum-thread-row-react: the same props (React names) and the same DOM for the same input.

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 { ForumThreadRow } from '@molecule/app-forum-thread-row-vue'

const App = defineComponent({
  setup() {
    const thread = { id: 't1', title: 'How do I reset my password?' }
    const openThread = (): void => {
      // navigate to the thread…
    }
    return () =>
      h(ForumThreadRow, {
        title: thread.title,
        excerpt: 'I tried the forgot-password link but never received an email.',
        voteScore: 42,
        replyCount: 7,
        viewCount: 320,
        author: 'alice',
        createdAt: '2 hours ago',
        onClick: openThread,
      })
  },
})

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

Type

feature

Installation

npm install @molecule/app-forum-thread-row-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue

API

Interfaces

ForumThreadRowProps

Props for ForumThreadRow.

interface ForumThreadRowProps {
  /** Thread title. */
  title: VNodeChild
  /** Optional snippet of the OP body. */
  excerpt?: VNodeChild
  /** Aggregate vote score / upvotes. */
  voteScore?: number
  /** Reply count. */
  replyCount?: number
  /** View count. */
  viewCount?: number
  /** Optional pinned indicator. */
  pinned?: boolean
  /** Optional locked indicator. */
  locked?: boolean
  /** Author display. */
  author?: VNodeChild
  /** Created-at display (relative or absolute). */
  createdAt?: VNodeChild
  /** Tag chips. */
  tags?: VNodeChild
  /** Right-side voting controls slot. */
  voteControls?: VNodeChild
  /**
   * Activates the row: the whole row is clickable through a transparent native
   * button laid over it (Enter and Space activate it natively), named by the
   * title — the `<h3>` itself takes the generated id. The `voteControls` and
   * `tags` slots sit above that button and keep their own clicks.
   */
  onClick?: () => void
  /** Extra classes. */
  className?: string
}

Constants

ForumThreadRow

Forum / discussion-board thread row. Shows the title, optional excerpt, vote score + reply/view counts, pin/lock badges, author, and timestamp. Pass voteControls to render up/down buttons inline.

The marker labels ("Pinned" / "Locked", announced through role="img" + aria-label) and the counter labels ("votes", "{{count}} replies", "{{count}} views") go through t() with those English defaults — the same text, through the same keys, React renders. The row has no root data-mol-id prop, exactly like React.

const ForumThreadRow: DefineComponent<
  ExtractPropTypes<{
    title: null
    excerpt: null
    voteScore: { type: NumberConstructor; default: undefined }
    replyCount: { type: NumberConstructor; default: undefined }
    viewCount: { type: NumberConstructor; default: undefined }
    pinned: { type: BooleanConstructor; default: undefined }
    locked: { type: BooleanConstructor; default: undefined }
    author: null
    createdAt: null
    tags: null
    voteControls: null
    onClick: { type: PropType<ForumThreadRowProps['onClick']>; default: undefined }
    className: { type: StringConstructor; default: undefined }
  }>,
  () => VNode,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      title: null
      excerpt: null
      voteScore: { type: NumberConstructor; default: undefined }
      replyCount: { type: NumberConstructor; default: undefined }
      viewCount: { type: NumberConstructor; default: undefined }
      pinned: { type: BooleanConstructor; default: undefined }
      locked: { type: BooleanConstructor; default: undefined }
      author: null
      createdAt: null
      tags: null
      voteControls: null
      onClick: { type: PropType<ForumThreadRowProps['onClick']>; default: undefined }
      className: { type: StringConstructor; default: undefined }
    }>
  > &
    Readonly<{}>,
  {
    onClick: (() => void) | undefined
    voteScore: number
    replyCount: number
    viewCount: number
    pinned: boolean
    locked: boolean
    className: string
  },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see ForumThreadRowProps).

Returns: The thread row 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.0
  • vue ^3.5.0

Runtime Dependencies

  • @molecule/app-ui

  • @molecule/app-ui-vue

  • @molecule/app-vue

  • vue

  • Styling routes through getClassMap() — a ClassMap bond (e.g. @molecule/app-ui-tailwind) must be wired or rendering throws.

  • KNOWN GAP (same as React): the counter labels ("votes", "replies", "views") and the pin/lock aria-labels are hardcoded English (there is no companion locale bond yet). For localized apps, pass pre-formatted content via tags / voteControls or wrap the row until the package routes text through t().

  • The row has no data-mol-id support yet; add your own wrapper attribute if AI-agent/e2e selectors need to target it.

  • Node-valued props (title, excerpt, author, createdAt, tags, voteControls) arrive as a prop AND a same-named slot; components accept either.

Translations

Translation strings are provided by @molecule/app-locales-forum-thread-row.