@molecule/app-pricing-table-svelte

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

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

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

npm · Source on GitHub

How it works

@molecule/app-pricing-table-svelte 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.

<script lang="ts">
  import { PricingTable } from '@molecule/app-pricing-table-svelte'

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

<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 } },
  ]}
/>

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

Reference

Svelte side-by-side pricing comparison table.

Exports <PricingTable> and PricingPlan / PricingFeature types — the Svelte 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 Svelte 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

<script lang="ts">
  import { PricingTable } from '@molecule/app-pricing-table-svelte'

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

<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 } },
  ]}
/>

Type

feature

Installation

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

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. A snippet or a plain string. */
  name: NodeContent
  /** Optional one-line plan description. A snippet or a plain string. */
  description?: NodeContent
  /** Plan price (a formatted string or a snippet). */
  price: NodeContent
  /** Optional billing interval shown beside the price (e.g. `/mo`). */
  interval?: NodeContent
  /** Call to action for this column. */
  cta?: { label: NodeContent; 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. A snippet or a plain string. */
  label: NodeContent
  /** Per-plan-id values: `true` / `false` / a string / a snippet. */
  values: Record<string, boolean | string | NodeContent>
  /** Optional category / group heading rendered above this row. */
  groupHeading?: NodeContent
}

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

const PricingTable: LegacyComponentType

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-svelte ^3.5.0 || ^4.0.0
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-svelte ^1.1.0
  • svelte ^5.0.0

Runtime Dependencies

  • @molecule/app-svelte
  • @molecule/app-ui
  • @molecule/app-ui-svelte
  • svelte

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