COMPONENT position-card
Position Card
Displays a user's position with shares, current value, average entry, and unrealized P&L. Feed with usePortfolio(address) for positions array, and mids from useMarkets for currentPrice. Key props: coin (string), shares (number), currentPrice (number), avgEntry? (number), onSell? (coin => void).
Install
$
npx shadcn@latest add https://ui.purrdict.xyz/r/position-card.json Preview
BTC UpYes
100 sharesAvg Entry
45¢
Current Price
65¢
Value
$65.00
P&L
+$20.00 (+44.4%)
0¢entry: 45¢100¢
Usage
import { PositionCard } from "@/components/hip4/position-card"
<PositionCard
coin={market.yesCoin}
shares={100}
avgEntry={0.45}
currentPrice={0.65}
onSell={(coin) => openSellDialog(coin)}
/> Props
| Prop | Type | Description |
|---|---|---|
coin | string | Coin identifier for the position |
shares | number | Number of shares held |
avgEntry | number | Average entry price. Optional — hides if unknown |
currentPrice | number | Current mid/mark price |
onSell | (coin: string) => void | Sell button click handler |
Dependencies
Registry components