Xzero UI
Pro library

Prize wheelPro

A referral or promo prize wheel you flick to spin, with real angular momentum, a flexible pointer that ticks against each peg, weighted segments set by the host, a slow suspenseful settle, and the won segment lifting into a reward card with a copyable code.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/prize-wheel
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/prize-wheel

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { PrizeWheel } from "@/components/xzero/prize-wheel/prize-wheel";

export function ReferralReward({ drawnIndex }: { drawnIndex: number }) {
  return <PrizeWheel
    once
    pickWinner={() => drawnIndex}
    segments={[
      { label: "10% off", detail: "Off your first year", code: "REF-10OFF", weight: 40 },
      { label: "Free month", detail: "One month on us", code: "REF-MONTH", weight: 25 },
      { label: "20% off", detail: "Off your first year", code: "REF-20OFF", weight: 20 },
      { label: "Extra seat", detail: "One more teammate for a year", code: "REF-SEAT", weight: 14 },
      { label: "Lifetime", detail: "Pro for life", code: "REF-LIFE", weight: 1, featured: true },
    ]}
    onResult={segment => console.log("won", segment.label)}
  />;
}

API reference

PrizeWheel

A promo or referral prize wheel with real momentum. Flick the wheel and it keeps the angular velocity you gave it, or hold the metal Spin hub to wind the wheel back while an accent ring fills, then let go to throw it. A flexible pointer bends against every peg and snaps back with a small wobble, the wheel slows into a long, suspenseful settle, and it lands on a segment drawn by weight. The won segment fills with the accent and lifts into a reward card with a copyable code, while the odds list beside the wheel shows every prize with its chance.

PropTypeDefaultDescription
segments{ id?: string; label: string; detail?: string; code?: string; weight?: number; featured?: boolean }[]Eight launch rewardsPrizes clockwise from the top, two to twelve. label is drawn on the wheel (keep it to about 14 characters), detail and code appear in the reward card, weight is the relative chance (defaults to 1), and featured marks the rare top prize with the accent.
titlestring"Spin for a reward"Heading beside the wheel before the first spin.
descriptionstring"Every spin wins something. Your code works at checkout."One line under the heading.
labels{ spin?; again?; done?; copy?; copied?; copyFailed?; odds?; hint?; weak? }–Visible words for localization: the hub label, Spin again, the locked hub label, the copy button states, the odds heading, the gesture hint, and the hint after a flick that was too slow.
pickWinner(segments) => number–Returns the winning index when a spin starts, such as a result your server already drew. Without it the wheel draws by weight in the browser, which suits a demo but not a real prize.
onResult(segment, index) => void–Called once when the wheel comes to rest on a prize.
oncebooleanfalseAllows a single spin. The wheel locks on the prize, the hub reads Claimed, and Spin again is hidden.
sizing"equal" | "weight""equal"Equal slices, or slice angles proportional to weight so the wheel itself shows the odds. Slices too thin for a label drop it; the odds list still names them.
showOddsbooleantrueShows the list of prizes with their chance beside the wheel.
speednumber1Multiplies the slow idle drift before a spin. 0 holds the wheel still.
pausedbooleanfalseHolds the idle drift. A spin the visitor starts still runs to the end.
accentstring–Color of the pointer, the featured prize, the charge ring, and the won segment. Defaults to the accent token.
labelstring"Prize wheel"Accessible name of the component. The wheel image adds every prize and its chance.
classNamestring–Extra class on the root.
styleCSSProperties–Inline styles on the root.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in playful

Guidance for AI tools

Prize wheel: A referral or promo prize wheel you flick to spin, with real angular momentum, a flexible pointer that ticks against each peg, weighted segments set by the host, a slow suspenseful settle, and the won segment lifting into a reward card with a copyable code. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components