@molecule/app-list-item-row-vue

Feature · list-item-row · App (browser) · v1.2.3 · Apache-2.0

Thumbnail + title + subtitle + metadata + actions row (nav lists, mobile menus)

npm install @molecule/app-list-item-row-vue

npm · Source on GitHub

How it works

@molecule/app-list-item-row-vue is a ready-made list-item-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 { ListItemRow } from '@molecule/app-list-item-row-vue'

const App = defineComponent({
  setup() {
    return () =>
      h(ListItemRow, {
        title: 'Project Alpha',
        subtitle: 'Last edited 2 hours ago',
        metadata: '3 collaborators · 12 files',
        leading: h('img', { src: '/icons/folder.svg', alt: '', width: 32, height: 32 }),
        actions: h('button', { onClick: () => openMenu('alpha') }, 'Menu'),
        onClick: () => navigate('/projects/alpha'),
      })
  },
})

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

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

Reference

Vue generic list-item row.

Exports <ListItemRow> — leading slot (icon/avatar/thumbnail) + up to three text lines (title / subtitle / metadata) + right-side actions. Props: title, subtitle?, metadata?, leading?, actions?, toggle?, onClick?, selected?, disabled?, density? ('comfortable' default | 'compact'), className?. Use for nav lists, mobile menus, search results, picker dialogs, inbox threads. For table rows use <RowWithActions> from @molecule/app-data-table-ui-vue instead — this component is not a <tr>. It is the Vue counterpart of @molecule/app-list-item-row-react: same props 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 { ListItemRow } from '@molecule/app-list-item-row-vue'

const App = defineComponent({
  setup() {
    return () =>
      h(ListItemRow, {
        title: 'Project Alpha',
        subtitle: 'Last edited 2 hours ago',
        metadata: '3 collaborators · 12 files',
        leading: h('img', { src: '/icons/folder.svg', alt: '', width: 32, height: 32 }),
        actions: h('button', { onClick: () => openMenu('alpha') }, 'Menu'),
        onClick: () => navigate('/projects/alpha'),
      })
  },
})

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

Type

feature

Installation

npm install @molecule/app-list-item-row-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue

API

Interfaces

ListItemRowProps

Props accepted by the ListItemRow component.

interface ListItemRowProps {
  /** Title — first line. A prop or the same-named slot — both work. */
  title: VNodeChild
  /** Optional second line (excerpt, description). A prop or the same-named slot — both work. */
  subtitle?: VNodeChild
  /** Optional third line (metadata — timestamps, counts, tags). A prop or the same-named slot — both work. */
  metadata?: VNodeChild
  /** Optional leading slot — icon, avatar, thumbnail image. A prop or the same-named slot — both work. */
  leading?: VNodeChild
  /** Optional right-side actions (buttons, action menu). A prop or the same-named slot — both work. */
  actions?: VNodeChild
  /** Loaded boolean action rendered as its own native button, independently of read-only metadata. */
  toggle?: {
    /** The loaded server value. */
    value: boolean
    /** Saves the desired boolean and resolves with the server-confirmed boolean. */
    commit: (desired: boolean) => Promise<boolean>
    /** Label when the displayed value is true. */
    activeLabel: VNodeChild
    /** Label when the displayed value is false. */
    inactiveLabel: VNodeChild
    /** Receives a failed save after the toggle restored the last confirmed value. */
    onError?: (error: unknown) => void
    /** Button variant. */
    variant?: ButtonVariant
    /** Button color. */
    color?: ColorVariant
    /** Button size. */
    size?: ButtonSize
    /** Whether the button stretches to fill its container. */
    fullWidth?: boolean
    /** Disables the toggle (permissions, never a pending save). */
    disabled?: boolean
    /** Left icon. */
    leftIcon?: VNodeChild
    /** Right icon. */
    rightIcon?: VNodeChild
    /** Extra classes. */
    className?: string
    /** Inline style object (React camelCase). */
    style?: ButtonProps['style']
    /** `data-testid`. */
    testId?: string
  }
  /**
   * Called when the row is activated. The whole row is clickable through a
   * transparent native button over it, named by the title; the inner controls
   * (the `actions` slot) sit above it and keep their own clicks.
   */
  onClick?: () => void
  /** When true, sets `aria-current="true"` on the row — no built-in visual highlight; style it via `className` or host CSS. */
  selected?: boolean
  /** When true, renders in a disabled visual state. */
  disabled?: boolean
  /** Dense vs comfortable spacing. Defaults to `'comfortable'`. */
  density?: 'comfortable' | 'compact'
  /** Extra classes. */
  className?: string
}

Constants

ListItemRow

Generic "thumbnail + text + actions" row — used everywhere: navigation lists, mobile menus, inbox-style threads, search results, picker dialogs, bookmark lists, etc.

With onClick the whole row is clickable through a transparent native button over it, named by the title (aria-labelledby); Enter / Space on that button run the same handler a click anywhere on the row runs, and the inner controls (the actions slot) sit above the button and keep their own clicks.

Different from <RowWithActions> in @molecule/app-data-table-ui-react in NOT being a <tr> — use this for non-table lists.

const ListItemRow: DefineComponent<
  ExtractPropTypes<{
    title: null
    subtitle: null
    metadata: null
    leading: null
    actions: null
    toggle: { type: PropType<ListItemRowProps['toggle']>; default: undefined }
    onClick: { type: PropType<() => void>; default: undefined }
    selected: { type: BooleanConstructor; default: undefined }
    disabled: { type: BooleanConstructor; default: undefined }
    density: { type: PropType<'comfortable' | 'compact'>; default: undefined }
    className: { type: StringConstructor; default: undefined }
  }>,
  () => VNode,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      title: null
      subtitle: null
      metadata: null
      leading: null
      actions: null
      toggle: { type: PropType<ListItemRowProps['toggle']>; default: undefined }
      onClick: { type: PropType<() => void>; default: undefined }
      selected: { type: BooleanConstructor; default: undefined }
      disabled: { type: BooleanConstructor; default: undefined }
      density: { type: PropType<'comfortable' | 'compact'>; default: undefined }
      className: { type: StringConstructor; default: undefined }
    }>
  > &
    Readonly<{}>,
  {
    toggle:
      | {
          value: boolean
          commit: (desired: boolean) => Promise<boolean>
          activeLabel: VNodeChild
          inactiveLabel: VNodeChild
          onError?: (error: unknown) => void
          variant?: ButtonVariant
          color?: ColorVariant
          size?: ButtonSize
          fullWidth?: boolean
          disabled?: boolean
          leftIcon?: VNodeChild
          rightIcon?: VNodeChild
          className?: string
          style?: ButtonProps['style']
          testId?: string
        }
      | undefined
    onClick: () => void
    selected: boolean
    disabled: boolean
    density: 'comfortable' | 'compact'
    className: string
  },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see ListItemRowProps).

Returns: The list-item 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

  • selected only sets the aria-current="true" attribute — no built-in highlight. Pass a highlight class via className (or target [aria-current="true"] in host CSS) to make selection visible.

  • With onClick the whole row is clickable through a transparent native button over it, named by the title (aria-labelledby); Enter / Space on that button run the same handler a click anywhere on the row runs, and the inner controls (the actions slot) sit above the button and keep their own clicks.

  • disabled halves the opacity and disables the open button (no pointer cursor, no activation); there is no data-mol-id prop.

  • Styling resolves through getClassMap() — wire a ClassMap bond first.

  • Node-valued props arrive as a prop AND a same-named slot; components accept either (the slot wins).