@molecule/app-pricing-table-vue

Feature · pricing-table · App (browser) · v1.1.1 · Apache-2.0

Features × plans matrix for side-by-side plan comparison

npm install @molecule/app-pricing-table-vue

npm · Source on GitHub

How it works

@molecule/app-pricing-table-vue is a ready-made pricing-table 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 { PricingTable } from '@molecule/app-pricing-table-vue'

const checkout = (planId: string): void => {
  window.location.assign(`/checkout?plan=${planId}`)
}

const Plans = defineComponent({
  setup() {
    return () =>
      h(PricingTable, {
        plans: [
          {
            id: 'starter',
            name: 'Starter',
            price: '$9',
            interval: '/mo',
            cta: { label: 'Get started', onClick: () => checkout('starter') },
          },
          {
            id: 'pro',
            name: 'Pro',
            price: '$29',
            interval: '/mo',
            recommended: true,
            cta: { label: 'Get started', onClick: () => checkout('pro') },
          },
        ],
        features: [
          { label: 'Projects', values: { starter: '3', pro: 'Unlimited' } },
          { label: 'Team members', values: { starter: false, pro: true } },
        ],
      })
  },
})

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

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

Reference

Vue side-by-side pricing comparison table.

Exports <PricingTable> and PricingPlan / PricingFeature types — the Vue counterpart of @molecule/app-pricing-table-react, with the same props and the same DOM for the same input. Switching an app from React to Vue is a change of the package name in its import.

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 { PricingTable } from '@molecule/app-pricing-table-vue'

const checkout = (planId: string): void => {
  window.location.assign(`/checkout?plan=${planId}`)
}

const Plans = defineComponent({
  setup() {
    return () =>
      h(PricingTable, {
        plans: [
          {
            id: 'starter',
            name: 'Starter',
            price: '$9',
            interval: '/mo',
            cta: { label: 'Get started', onClick: () => checkout('starter') },
          },
          {
            id: 'pro',
            name: 'Pro',
            price: '$29',
            interval: '/mo',
            recommended: true,
            cta: { label: 'Get started', onClick: () => checkout('pro') },
          },
        ],
        features: [
          { label: 'Projects', values: { starter: '3', pro: 'Unlimited' } },
          { label: 'Team members', values: { starter: false, pro: true } },
        ],
      })
  },
})

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

Type

feature

Installation

npm install @molecule/app-pricing-table-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue

API

Interfaces

PricingPlan

Describes a single plan column in the pricing table.

interface PricingPlan {
  /** Stable plan id; also the key its feature values are read by. */
  id: string
  /** Plan name, rendered as the column heading. */
  name: VNodeChild
  /** Optional one-line plan description. */
  description?: VNodeChild
  /** Plan price (a formatted string or a node). */
  price: VNodeChild
  /** Optional billing interval shown beside the price (e.g. `/mo`). */
  interval?: VNodeChild
  /** Call to action for this column. */
  cta?: { label: VNodeChild; onClick?: () => void; href?: string }
  /** Visually emphasise as recommended / featured. */
  recommended?: boolean
}

PricingFeature

Describes a single feature row and its per-plan values in the pricing table.

interface PricingFeature {
  /** Row label. */
  label: VNodeChild
  /** Per-plan-id values: `true` / `false` / a string / a node. */
  values: Record<string, boolean | string | VNodeChild>
  /** Optional category / group heading rendered above this row. */
  groupHeading?: VNodeChild
}

PricingTableProps

Props accepted by the PricingTable component (React's prop names).

interface PricingTableProps {
  /** The plan columns, left to right. */
  plans: PricingPlan[]
  /** The feature rows, top to bottom. */
  features: PricingFeature[]
  /** Extra classes on the outer wrapper. */
  className?: string
}

Constants

PricingTable

Side-by-side pricing comparison — features × plans matrix. A header row holds plan cards (name, price, CTA); body rows show per-feature availability (true → ✓, false → —, strings/nodes pass through). The wrapper scrolls horizontally when columns overflow.

const PricingTable: DefineComponent<
  ExtractPropTypes<{
    plans: { type: PropType<PricingPlan[]>; required: true }
    features: { type: PropType<PricingFeature[]>; required: true }
    className: StringConstructor
  }>,
  () => VNode,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      plans: { type: PropType<PricingPlan[]>; required: true }
      features: { type: PropType<PricingFeature[]>; required: true }
      className: StringConstructor
    }>
  > &
    Readonly<{}>,
  {},
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see PricingTableProps).

Returns: The rendered pricing table 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

All text arrives via props — pass pre-translated strings; requires a wired ClassMap bond.