---
title: "Prediction Market Trade Ticket"
description: "Free React trade ticket to buy and sell prediction market outcomes, with rolling amount entry, quick add chips and trade states. Framer Motion, shadcn install."
category: "Blocks"
parent: "https://beui.dev/components/blocks/prediction-market"
publishedAt: "2026-06-18"
updatedAt: "2026-11-25"
documentation: "https://beui.dev/components/blocks/prediction-market/trade-ticket"
markdown: "https://beui.dev/components/blocks/prediction-market/trade-ticket.md"
license: "MIT"
---

# Prediction Market Trade Ticket

> Free React trade ticket to buy and sell prediction market outcomes, with rolling amount entry, quick add chips and trade states. Framer Motion, shadcn install.

## Install

```bash
npx shadcn@latest add @beui/prediction-market
```

## Dependencies

- `@floating-ui/dom`
- `clsx`
- `lucide-react`
- `motion`
- `react`
- `react-dom`
- `tailwind-merge`

## Usage

### Trade Ticket usage

Buy and sell outcomes with rolling amount entry, quick add chips and trade states.

```tsx
"use client";

import { useState } from "react";
import {
  PredictionMarket,
  type PredictionMarketOrderValue,
} from "@/components/motion/prediction-market";

const outcomes = [
  {
    id: "yes",
    label: "Yes",
    price: 0.167,
  },
  {
    id: "no",
    label: "No",
    price: 0.834,
  },
];

export function PredictionMarketPreview() {
  const [order, setOrder] = useState<PredictionMarketOrderValue>({
    mode: "buy",
    outcomeId: "yes",
    amount: "115",
  });

  return (
    <div className="flex w-full items-center justify-center">
      <PredictionMarket
        outcomes={outcomes}
        value={order}
        onValueChange={setOrder}
        balance={500}
        positions={{ yes: 125, no: 48 }}
        quickAmounts={[1, 5, 10, 100]}
      />
    </div>
  );
}
```

## API Reference

### PredictionMarket

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `outcomes` | `PredictionMarketOutcome[]` | `[ { id: "up", label: "Up", price: 0.09 }, { id: "down", label: "Down", price: 0.91 }, ]` | No | Outcomes to trade, each with a price from 0 to 1. Default: Up and Down |
| `value` | `PredictionMarketOrderValue` | — | No | The order's mode, outcome and amount, for controlled use. |
| `defaultValue` | `Partial<PredictionMarketOrderValue>` | — | No | The initial order when uncontrolled. Missing fields start as buy, the first outcome and empty. |
| `onValueChange` | `((value: PredictionMarketOrderValue) => void)` | — | No | Called with the full order when the mode, outcome or amount changes. |
| `onTrade` | `((order: PredictionMarketOrderValue, quote: PredictionMarketQuote) => void)` | — | No | Called with the order and its quote once a valid trade fills. |
| `onSignIn` | `(() => void)` | — | No | Called when the connect button is pressed while signed out. |
| `authenticated` | `boolean` | `true` | No | Whether the user is signed in. When false, a connect button replaces the trade footer. Default: true |
| `orderTypeLabel` | `string` | — | No | Text beside the buy and sell tabs. Default: "Market" |
| `balance` | `number` | `500` | No | Cash available to buy with, in dollars. Default: 500 |
| `positions` | `Record<string, number>` | `{ up: 24, down: 16 }` | No | Shares held per outcome id, which caps how much can be sold. |
| `quickAmounts` | `number[]` | `[10, 50, 100, 500]` | No | Amounts the quick chips add to the input. Default: [10, 50, 100, 500] |
| `minTrade` | `number` | `1` | No | Smallest buy amount, in dollars. Default: 1 |
| `labels` | `Partial<{ buy: string; sell: string; orderType: string; amount: string; shares: string; max: string; toWin: string; toReceive: string; avgPrice: string; trade: string; trading: string; tradeFilled: string; ... 4 more ...; notEnoughShares: string; }>` | — | No | Override any built-in string. `{price}` fills `avgPrice`, `{amount}` fills `minimum`. |
| `className` | `string` | — | No | Classes merged onto the root element. |
| `classNames` | `PredictionMarketClassNames` | — | No | Classes for each inner part, keyed by slot. |

## Types

### PredictionMarketOutcome

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | Unique key, used as the order's `outcomeId` and the `positions` key. |
| `label` | `string` | Yes | Text on the outcome button. "No" and "Down" are styled red. |
| `price` | `number` | Yes | Price per share from 0 to 1, shown in cents. |

### PredictionMarketOrderValue

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `mode` | `PredictionMarketMode` | Yes | Whether the order buys or sells shares. |
| `outcomeId` | `string` | Yes | The `id` of the selected outcome. |
| `amount` | `string` | Yes | Raw input text: dollars when buying, shares when selling. |

### PredictionMarketQuote

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `valid` | `boolean` | Yes | Whether the order can be placed. |
| `amount` | `number` | Yes | The parsed amount: dollars when buying, shares when selling. |
| `price` | `number` | Yes | Price per share, clamped between 0.01 and 0.99. |
| `shares` | `number` | Yes | Shares bought, or shares sold. |
| `payout` | `number` | Yes | Dollars won if the outcome resolves, or dollars received from a sale. |
| `error` | `string` | No | Why the order is invalid, shown on the trade button. Absent when valid. |

### PredictionMarketClassNames

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `root` | `string` | No | Classes for the outer card. |
| `header` | `string` | No | Classes for the top bar with the buy and sell tabs. |
| `tabs` | `string` | No | Classes for the buy and sell tabs. |
| `outcomes` | `string` | No | Classes for the outcome buttons. |
| `amount` | `string` | No | Classes for the amount panel with the input and chips. |
| `chips` | `string` | No | Classes for the row of quick amount chips. |
| `footer` | `string` | No | Classes for the footer with the payout and trade button. |
| `action` | `string` | No | Classes for the trade or connect button. |

## More in Prediction Market

- [Prediction Market Cards](https://beui.dev/components/blocks/prediction-market/market-cards.md)

## Source

- Registry detail: https://beui.dev/r/prediction-market
- Raw source: https://beui.dev/r/prediction-market/raw
- GitHub: https://github.com/starc007/ui-components
