COMPONENT market-card

Market Card

Display card for HIP-4 prediction markets with 4 variants: "event" (Yes/No), "recurring" (Up/Down with asset logo), "named-binary" (custom side names), "question" (multi-outcome). Pass market object from useMarkets() and yesMid from mids map. Key props: market (Market), yesMid (number), volume? (number), variant? (MarketVariant), onClick? (callback).

Install

$ npx shadcn@latest add https://ui.purrdict.xyz/r/market-card.json

Preview

BTC

Bitcoin 15 Min Up or Down?

Target: $87,450

65%
Live
2h 15m 30s
Usage
import { MarketCard } from "@/components/hip4/market-card"
import { useMarkets } from "@/hooks/hip4/use-markets"

function MarketList() {
  // Variant auto-detected from market.description
  // Prices auto-resolved from mids map
  const { markets, mids } = useMarkets()

  return (
    <div className="grid grid-cols-3 gap-4">
      {markets.map((m) => (
        <MarketCard
          key={m.yesCoin}
          market={m}
          mids={mids}
          onSideClick={(side) =>
            router.push(`/market/${m.yesCoin}?side=${side}`)
          }
        />
      ))}
    </div>
  )
}
Props
Prop Type Description
variant MarketVariant "event" | "recurring" | "named-binary" | "question". Default: "event"
market Market Market object — required for event/recurring variants
yesMid number | string Yes mid price (0-1)
noMid number | string No mid price. Defaults to 1 - yesMid
volume number 24h volume in USDH
underlying string Asset symbol for recurring variant (e.g. "BTC")
title string Card title for named-binary variant
sides NamedSide[] Named sides for named-binary variant ({name, avatarUrl?})
questionName string Question title for question variant
outcomes Outcome[] Outcomes for question variant ({name, yesPx})
onClick () => void Click handler

Dependencies

npm packages

Registry components