Prediction Market

A trade ticket for prediction markets: switch between buy and sell, choose an outcome by price, type an amount that rolls digit by digit or bump it with quick chips, and see shares and payout before placing the trade.

Preview

Prediction Market preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/prediction-market
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

outcomes?
PredictionMarketOutcome[]
[ { id: "up", label: "Up", price: 0.09 }, { id: "down", label: "Down", price: 0.91 }, ]
value?
PredictionMarketOrderValue
—
defaultValue?
Partial<PredictionMarketOrderValue>
—
onValueChange?
((value: PredictionMarketOrderValue) => void)
—
onTrade?
((order: PredictionMarketOrderValue, quote: PredictionMarketQuote) => void)
—
onSignIn?
(() => void)
—
authenticated?
boolean
true
orderTypeLabel?
string
Market
balance?
number
500
positions?
Record<string, number>
{ up: 24, down: 16 }
quickAmounts?
number[]
[10, 50, 100, 500]
minTrade?
number
1
className?
string
—
classNames?
PredictionMarketClassNames
—

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.

Updated