Skip to content

shadcn.io is an independent project built on shadcn/ui

Comparison Product Card Block for Vue

Four cordless vacuums in a row; tick Compare on two and their own spec rows mark the better value with a check and the word Better, ties say Same, and a third tick is refused in words.

UI library: Ark UI

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Compare products without leaving the tiles with this comparison product card for Vue with Ark UI. A hairline frame with a plus mark on each corner holds four vacuum tiles between shared hairlines, two across on a phone. Each tile has a drawn model, its name, the price, four spec rows (suction, run time, weight and bin) and a "Compare" Toggle. Tick two and each ticked tile's own rows mark the better figure with a check and the word "Better", with "Same" for a tie. A third tick is refused in words: "Compare two at a time". There is no docked bar, sheet or table: the rows keep their boxes, so nothing moves. The status line says who wins on how many rows, the heading row counts "Comparing" and "Bag", and Add to bag is an outline Button that turns into "Added" with an Undo. The figures are typed. Nothing is stored or bought. Guides rule the bands. For ranges where a shopper decides between two models.

FAQ

How do I change the specs?

Edit SPECS for the rows, with a higher flag that says whether a bigger figure is better (it is not for weight), and VACUUMS for each model's figures. Weight is in tenths of a kilo and the bin in millilitres, and textOf writes the units. verdictOf does the comparing.

What happens on a tie, and on the worse side?

A tie says "Same" on both tiles. The tile with the worse figure shows nothing in that row's slot, because the other tile already says "Better"; the slot is reserved, so the row keeps its height.

Are the figures real?

No. They are typed for the demo and the status line says so. For a real product, use figures you can back up and say how they were measured next to them.

What stays local, and how do I wire it for real?

The ticks and the bag are page state; nothing is stored, charged or sent. Replace the body of add and undo with calls to your cart, and load VACUUMS from your catalogue. The pictures are typed shapes: swap Picture for an img.

How does it look on a phone?

Two tiles across, so you can tick any two and see both of their rows at once if they are side by side, or scroll between them. The spec rows are small label and figure pairs, and the verdict slot holds its width.

Is it accessible?

The specs are a description list per tile. Each Compare toggle is named for its model and reports its pressed state, with a check as well as a ring, and the verdict is a word as well as a glyph. The refusal and the result are announced by the polite status line.