ValyroUI English version

Compare Tray

Полка сравнения: собрать объекты и сравнить в таблице. Бесплатно, MIT · Магазин и платежи › Каталог

Установка

npx valyro-cli@latest add compare-tray
npx shadcn@latest add https://valyro.xyz/r/compare-tray.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { CompareTray } from 'valyro-ui';

Пропсы

PropTypeDefault
items *ComparableItem[]Every item that can be compared (usually the catalog).
fieldsCompareField[][]Rows of the built-in table, in order.
selectedIdsstring[]Picked ids, shared with the catalog's compare buttons (see toggleCompare).
defaultSelectedIdsstring[][]Initial selectedIds when uncontrolled.
onSelectedIdsChange(ids: string[]) => voidCalled with the new selectedIds when it changes.
maxItemsnumber3Most items in the tray. Default 3.
minItemsnumber2Fewest items to open the comparison. Default 2.
placement'inline' | 'fixed-bottom''inline'inline (default) in the page flow; fixed-bottom pinned to the viewport, with its height reserved in the flow.
onCompare(ids: string[]) => voidHands the comparison to the app (a page, a route). Not together with renderComparison.
renderComparison(items: ComparableItem[], close: () => void) => ReactNodeYour own comparison view inside the dialog, instead of the built-in table.
labelsPartial<CompareTrayLabels>Overrides for the built-in English text; keys left out keep their defaults.

Похожие компоненты

  • Product Card — Карточка товара
  • Product Grid — Каталог товаров
  • Product Filters — Фильтры каталога
  • Product Spotlight — Рекомендованный товар: фото с пометкой, цена, рейтинг и действия
  • Reviews Summary — Отзывы: средняя оценка, гистограмма-фильтр, сортировка и полезность
  • Guided Product Finder — Мастер подбора товара: вопросы с ветвлением и объяснение, почему подошло
  • Location Card — Точка продаж: расстояние, часы работы, способы получения и заказ
  • Shopping Cart Drawer — Выдвижная корзина
  • Checkout Summary — Сводка оформления заказа
  • Checkout Form — Оформление заказа: доставка, тип адреса, оплата и проверка полей
  • Order Tracking — Отслеживание заказа: этапы, перевозчик, трек-номер и история
  • Invoice — Счёт для печати: позиции, налоги, скидки и итоги в валюте

Назад: Guided Product Finder · Далее: Location Card · Весь раздел «Магазин и платежи»