@molecule/app-info-display-vue

Feature · info-display · App (browser) · v1.1.1 · Apache-2.0

InfoCard and DefinitionList for structured label/value metadata display

npm install @molecule/app-info-display-vue

npm · Source on GitHub

How it works

@molecule/app-info-display-vue is a ready-made info-display 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 { InfoCard } from '@molecule/app-info-display-vue'

const Details = defineComponent({
  setup() {
    return () =>
      h(InfoCard, {
        title: 'Company Details',
        fields: [
          { label: 'Industry', value: 'Technology' },
          { label: 'Founded', value: '2018' },
          { label: 'Employees', value: '120–150' },
        ],
        columns: 2,
        dataMolId: 'company-info-card',
      })
  },
})

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

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

Reference

Vue InfoCard and DefinitionList for structured label/value metadata.

Exports:

  • <InfoCard> — Card-wrapped DefinitionList with title, icon, actions.
  • <DefinitionList> — standalone label/value grid.
  • DefinitionField type.

This is the Vue counterpart of @molecule/app-info-display-react: the same export names, 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 { InfoCard } from '@molecule/app-info-display-vue'

const Details = defineComponent({
  setup() {
    return () =>
      h(InfoCard, {
        title: 'Company Details',
        fields: [
          { label: 'Industry', value: 'Technology' },
          { label: 'Founded', value: '2018' },
          { label: 'Employees', value: '120–150' },
        ],
        columns: 2,
        dataMolId: 'company-info-card',
      })
  },
})

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

Type

feature

Installation

npm install @molecule/app-info-display-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue

API

Interfaces

DefinitionField

A single label/value pair rendered inside a DefinitionList.

interface DefinitionField {
  /** Label content (usually `t('...')`). Passed as a VNode or plain text. */
  label: VNodeChild
  /** Rendered value. */
  value: VNodeChild
  /** Optional icon rendered to the left of the label. */
  icon?: VNodeChild
}

DefinitionListProps

Props for DefinitionList.

interface DefinitionListProps {
  /** Fields to render. */
  fields: DefinitionField[]
  /** Grid column count. Defaults to `1`. */
  columns?: 1 | 2 | 3
  /** Extra classes. */
  className?: string
}

InfoCardProps

Props for InfoCard.

interface InfoCardProps {
  /** Card heading. Passed as a prop or as the same-named slot — both work. */
  title?: VNodeChild
  /** Optional leading icon. Passed as a prop or as the same-named slot. */
  icon?: VNodeChild
  /** Optional right-side header actions. Passed as a prop or as the same-named slot. */
  actions?: VNodeChild
  /** Structured fields to display. */
  fields: DefinitionField[]
  /**
   * Grid column count — `1` stacks labels above values, `2+` puts labels beside
   * values. Defaults to `1`.
   */
  columns?: 1 | 2 | 3
  /** Extra classes on the outer Card. */
  className?: string
  /** `data-mol-id` for AI-agent selectors. */
  dataMolId?: string
}

Constants

DefinitionList

Structured label/value pair list. Use standalone or inside <InfoCard>. Apps pass already-formatted values (dates, currency, status pills, etc.) as nodes.

columns={1} stacks each label above its value; 2/3 arrange the fields in a grid. The list uses ClassMap tokens only, so the styling library can be swapped without touching consumers.

const DefinitionList: DefineComponent<
  ExtractPropTypes<{
    fields: { type: PropType<DefinitionField[]>; required: true }
    columns: { type: PropType<1 | 2 | 3>; default: number }
    className: StringConstructor
  }>,
  () => VNode,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      fields: { type: PropType<DefinitionField[]>; required: true }
      columns: { type: PropType<1 | 2 | 3>; default: number }
      className: StringConstructor
    }>
  > &
    Readonly<{}>,
  { columns: 1 | 2 | 3 },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see DefinitionListProps).

Returns: The definition list component.

InfoCard

Card wrapping a <DefinitionList> of metadata fields.

Used all over CRM/helpdesk/finance detail pages (CompanyInfoCard, DealInfoCard, TicketDetailsCard, TransactionDetailsCard) — same shape everywhere, only the fields differ.

const InfoCard: DefineComponent<
  ExtractPropTypes<{
    title: null
    icon: null
    actions: null
    fields: { type: PropType<DefinitionField[]>; required: true }
    columns: { type: PropType<1 | 2 | 3>; default: number }
    className: StringConstructor
    dataMolId: StringConstructor
  }>,
  () => VNode,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      title: null
      icon: null
      actions: null
      fields: { type: PropType<DefinitionField[]>; required: true }
      columns: { type: PropType<1 | 2 | 3>; default: number }
      className: StringConstructor
      dataMolId: StringConstructor
    }>
  > &
    Readonly<{}>,
  { columns: 1 | 2 | 3 },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see InfoCardProps).

Returns: The info card 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 || ^4.0.0
  • vue ^3.4.0

Runtime Dependencies

  • @molecule/app-ui
  • @molecule/app-ui-vue
  • @molecule/app-vue
  • vue

Purely presentational: pass already-formatted / already-translated nodes as labels and values. getClassMap() requires a bonded ClassMap (e.g. @molecule/app-ui-tailwind) — there is no other wiring. columns={1} stacks label above value; 2/3 arrange fields in a grid. Node-valued props (title, icon, actions) arrive as a prop AND a same-named slot; components accept either.