defmodule PhiaUi.Components.ComparisonTable do @moduledoc """ Comparison table — feature-by-feature grid for plan/product comparison. Inspired by pricing page tables in shadcn blocks and PricingCard grid patterns. Common use cases: SaaS pricing pages, product spec sheets, feature matrices. Highlighted columns (`:highlighted: true` in plan map) receive a distinct background and border to draw attention to a recommended plan. ## Examples <.comparison_table plans={[ %{name: "Starter", highlighted: false}, %{name: "Pro", highlighted: true}, %{name: "Enterprise", highlighted: false} ]} features={[ %{label: "Users", values: ["1", "Up to 10", "Unlimited"]}, %{label: "API Access", values: [false, true, true]}, %{label: "SLA", values: [false, false, "99.99%"]} ]} /> """ use Phoenix.Component import PhiaUi.ClassMerger, only: [cn: 1] import PhiaUi.Components.Icon, only: [icon: 1] attr(:plans, :list, required: true, doc: "List of plan maps with `:name` (string) and `:highlighted` (boolean)." ) attr(:features, :list, required: true, doc: "List of feature maps with `:label` (string) and `:values` ([true|false|string]) " <> "— one value per plan, in the same order as `:plans`." ) attr(:class, :string, default: nil, doc: "Additional CSS classes for the root element.") attr(:rest, :global, doc: "HTML attributes forwarded to the root `
| {plan.name} | |
|---|---|
| {feature.label} | <.cell_content value={value} /> |