@molecule/app-contact-display-vue

Feature · contact-display · App (browser) · v1.1.3 · Apache-2.0

Formatted contact display: name + avatar + email/phone with icons + optional address

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

npm · Source on GitHub

How it works

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

const Profile = defineComponent({
  setup() {
    return () =>
      h(ContactDisplay, {
        contact: {
          name: 'Jane Smith',
          email: 'jane@example.com',
          phone: '+1 555 0100',
          role: 'Product Designer',
          company: 'Acme Corp',
        },
        layout: 'row',
        onClick: () => openProfile('jane'),
      })
  },
})

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

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

Reference

Vue formatted contact display.

Exports <ContactDisplay> — avatar + name + role + email/phone/address with card/row/compact layouts. It is the Vue counterpart of @molecule/app-contact-display-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 { ContactDisplay } from '@molecule/app-contact-display-vue'

const Profile = defineComponent({
  setup() {
    return () =>
      h(ContactDisplay, {
        contact: {
          name: 'Jane Smith',
          email: 'jane@example.com',
          phone: '+1 555 0100',
          role: 'Product Designer',
          company: 'Acme Corp',
        },
        layout: 'row',
        onClick: () => openProfile('jane'),
      })
  },
})

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

Type

feature

Installation

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

API

Interfaces

ContactFields

Fields describing a contact rendered by ContactDisplay.

interface ContactFields {
  /** Display name. */
  name: string
  /** Email address, rendered as a `mailto:` link in the card and row layouts. */
  email?: string
  /** Phone number, rendered as a `tel:` link in the card and row layouts. */
  phone?: string
  /** Role / title, shown beside the name. */
  role?: VNodeChild
  /** Avatar image URL; without one the name's initials are shown. */
  avatarSrc?: string
  /** Postal address, shown under the phone line. */
  address?: VNodeChild
  /** Company name, shown under the name line. */
  company?: VNodeChild
}

ContactDisplayProps

Props accepted by the ContactDisplay component.

interface ContactDisplayProps {
  /** The contact to display. */
  contact: ContactFields
  /** Layout preset. Defaults to `'card'`. */
  layout?: 'card' | 'row' | 'compact'
  /** Optional right-side actions — passed as a prop or as the `actions` slot. */
  actions?: VNodeChild
  /**
   * Activates the contact: the whole row becomes clickable through a
   * transparent native button covering it, named by the contact name (the
   * name span), so Enter and Space activate it natively. The row's inner
   * controls — the mail/tel links and the `actions` slot — sit above that
   * button and keep their own clicks.
   */
  onClick?: () => void
  /** Extra classes. */
  className?: string
}

Constants

ContactDisplay

Formatted contact display — avatar + name + role + email/phone with leading icons + optional address and company. Three layouts for different densities.

Vue counterpart of @molecule/app-contact-display-react's ContactDisplay: the same props (React names), the same ClassMap tokens, and the same DOM for the same input. role, address and company are node-valued fields; actions is a node-valued prop that also accepts the same-named slot.

const ContactDisplay: DefineComponent<
  ExtractPropTypes<{
    contact: { type: PropType<ContactFields>; required: true }
    layout: { type: PropType<'card' | 'row' | 'compact'>; default: string }
    actions: null
    onClick: { type: PropType<() => void>; default: undefined }
    className: { type: StringConstructor; default: undefined }
  }>,
  () => VNode,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      contact: { type: PropType<ContactFields>; required: true }
      layout: { type: PropType<'card' | 'row' | 'compact'>; default: string }
      actions: null
      onClick: { type: PropType<() => void>; default: undefined }
      className: { type: StringConstructor; default: undefined }
    }>
  > &
    Readonly<{}>,
  { layout: 'card' | 'row' | 'compact'; onClick: () => void; className: string },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see ContactDisplayProps).

Returns: The contact display 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.5.0

Runtime Dependencies

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

contact fields are display-only data — email/phone render as mailto:/tel: links; there is no formatting/validation. The email/phone/ address markers are text glyphs (✉ ☎ ⌂), not themed SVG icons. role, address, and company accept Vue nodes — pass translated strings via t() where needed. When onClick is provided the whole row becomes clickable through a transparent native button covering it, named by the contact name (the name span); the mail/tel links and the actions slot sit above that button and keep their own clicks.