Skip to content

@maxhealth.tech/prefab / auto / autoComparison

Function: autoComparison()

ts
function autoComparison(items, options?): ContainerComponent;

Defined in: auto/comparison.ts:40

Auto-generate a side-by-side comparison of items.

Uses the first key of each item as the card heading. Remaining keys are shown as labeled rows.

Parameters

ParameterType
itemsRecord<string, unknown>[]
options?AutoComparisonOptions

Returns

ContainerComponent

Example

ts
autoComparison([
  { name: 'Plan A', price: '$10/mo', storage: '5GB' },
  { name: 'Plan B', price: '$20/mo', storage: '50GB' },
], { title: 'Plan Comparison', highlightKey: 'price' })

Released under the MIT License.