@casinokit/ui
v0.1.4
Published
Casino-focused React UI components for CasinoKit.
Maintainers
Readme
@casinokit/ui
Casino-centric UI component library. Like shadcn/ui, but built for iGaming — opinionated design tokens, Base UI primitives under the hood, and casino-domain components out of the box.
Table of Contents
Philosophy
- Base UI for primitives —
Button,Input,Checkbox,Select,Modalall wrap@base-ui/reactfor accessible, unstyled headless behaviour - One token system — all design decisions live in
--ck-*CSS custom properties. No shadcn HSL vars, no split systems - Casino-first components —
GameCard,GameGrid,PromotionCardand other casino primitives are first-class, not afterthoughts - Tailwind utilities — every token is exposed as a Tailwind class (
bg-ck-bg,text-ck-fg,border-ck-border, etc.) via@theme
Setup
1. Install
pnpm add @casinokit/ui2. Import the stylesheet
In your app's entry point (e.g. main.tsx or layout.tsx):
import '@casinokit/ui/styles.css';Theming
This library relies 100% on CSS Custom Properties for theming, ensuring zero Javascript overhead and preventing flash-of-unstyled-content (FOUC) on hydration.
All design tokens are defined in your globals.css file under :root:
:root {
/* Surfaces */
--ck-bg: #0f212e;
--ck-surface: #1a2c38;
--ck-surface-alt: #2f4553;
/* Brand Primary */
--ck-primary: #1475e1;
--ck-primary-fg: #ffffff;
/* Text */
--ck-fg: #ffffff;
--ck-muted-fg: #b1bad3;
/* Borders */
--ck-border: #2f4553;
/* Edges */
--ck-radius: 4px;
}Components
Core (Base UI primitives)
Core controls are customizable through semantic variants, consistent sizes, className, native component props, and refs. The current form customization layer includes:
Input,Textarea, andSelectTriggervariants:default,filled,flushed,error, andsuccessInput,Textarea, andSelectTriggersizes:sm,md, andlgTypographyvariants for display, title, heading, body, label, code, and muted text- Composable
Field,FieldLabel,FieldDescription, andFieldErrorprimitives for consistent form layouts
Application-wide defaults are intentionally not centralized in a provider yet; use component variants, design tokens, and className overrides for now.
Button
import { Button } from '@casinokit/ui';
<Button>Play Now</Button>
<Button variant="outline" size="lg">View Lobby</Button>
<Button variant="destructive">Delete</Button>
<Button loading>Processing...</Button>Toast / Notifications
Provides a powerful, casino-themed notification system built securely on @base-ui/react/toast.
Setup:
Place the <Toaster /> component once at the root of your application.
import { Toaster } from '@casinokit/ui';
export function App() {
return (
<>
<Toaster />
<YourApp />
</>
)
}Usage:
Import the toast object and trigger notifications anywhere in your app.
import { toast } from '@casinokit/ui';
// Standard notifications
toast.success("Settings saved");
toast.error("Payment failed", "Please check your card details.");
// Casino-specific notifications (with neon glow and custom icons)
toast.win("BIG WIN!", "You won $1,500.00 on Sweet Bonanza!");
toast.bonus("Level Up!", "You've reached VIP Bronze. Here's 50 Free Spins.");
toast.deposit("$500.00", "Via Bitcoin network.");
toast.cashback("$12.50", "Weekly cashback credited to your wallet.");
// Advanced Customization
toast.add({
title: "Server Rebooting",
description: "Estimated downtime: 5 mins",
className: "bg-red-900 border-red-500 text-white", // override theme
icon: <ServerIcon /> // custom icon
});
// Full Render Replacement
toast.add({
content: (
<div className="flex animate-pulse bg-gradient-to-r from-purple-500 to-pink-500 p-6 rounded-xl">
<h1 className="text-2xl font-black">MY CUSTOM TOAST!</h1>
</div>
)
});Variants: default · destructive · outline · secondary · ghost · link
Sizes: default · sm · lg · icon
Input
A highly accessible text input. It defaults to a 16px font size (text-[16px] md:text-sm) on mobile devices to completely prevent the frustrating iOS Safari auto-zoom bug, gracefully scaling down on desktop screens!
import { Input } from '@casinokit/ui';
<Input placeholder="Username" />
<Input type="password" placeholder="Password" />
<Input error placeholder="Invalid address" />
<Input variant="filled" size="lg" placeholder="Large filled input" />Variants: default · filled · flushed · error · success
Sizes: sm · md · lg
Textarea
import { Textarea } from '@casinokit/ui';
<Textarea placeholder="Write a note..." rows={4} />
<Textarea variant="filled" size="lg" placeholder="Large filled textarea" />Variants: default · filled · flushed · error · success
Sizes: sm · md · lg
Field
Use the composable field pieces to keep labels, descriptions, and errors consistent while retaining full control over the form control itself.
import { Field, FieldLabel, FieldDescription, FieldError, Input } from '@casinokit/ui';
<Field>
<FieldLabel htmlFor="username">Username</FieldLabel>
<Input id="username" variant="filled" />
<FieldDescription>Your public display name.</FieldDescription>
<FieldError>That username is already taken.</FieldError>
</Field>Checkbox
import { Checkbox } from '@casinokit/ui';
<Checkbox label="I agree to the terms" />
<Checkbox label="Receive promotions" defaultChecked />Radio / RadioGroup
import { RadioGroup, Radio } from '@casinokit/ui';
<RadioGroup>
<Radio value="crypto" label="Crypto" />
<Radio value="fiat" label="Fiat" />
</RadioGroup>Select
import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@casinokit/ui';
<Select>
<SelectTrigger>
<SelectValue placeholder="Choose currency" />
</SelectTrigger>
<SelectContent>
<SelectItem value="btc">Bitcoin (BTC)</SelectItem>
<SelectItem value="eth">Ethereum (ETH)</SelectItem>
<SelectItem value="usdt">Tether (USDT)</SelectItem>
</SelectContent>
</Select>SelectTrigger supports the same semantic variants and sizes as Input:
<SelectTrigger variant="filled" size="lg">
<SelectValue placeholder="Choose currency" />
</SelectTrigger>Card
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@casinokit/ui';
<Card>
<CardHeader>
<CardTitle>Recent Bets</CardTitle>
<CardDescription>Your last 10 wagers</CardDescription>
</CardHeader>
<CardContent>
{/* table or content */}
</CardContent>
<CardFooter>
<Button variant="ghost">View all</Button>
</CardFooter>
</Card>Modal
import {
Modal, ModalTrigger, ModalContent,
ModalHeader, ModalTitle, ModalDescription,
ModalBody, ModalFooter, ModalClose,
Button,
} from '@casinokit/ui';
<Modal>
<ModalTrigger render={<Button>Deposit</Button>} />
<ModalContent>
<ModalHeader>
<ModalTitle>Deposit Funds</ModalTitle>
<ModalDescription>Choose a method to top up your account</ModalDescription>
<ModalClose />
</ModalHeader>
<ModalBody>
{/* deposit form */}
</ModalBody>
<ModalFooter>
<Button>Confirm</Button>
</ModalFooter>
</ModalContent>
</Modal>Badge
import { Badge } from '@casinokit/ui';
<Badge>Default</Badge>
<Badge variant="primary">Live</Badge>
<Badge variant="vip">VIP</Badge>
<Badge variant="success">Paid Out</Badge>
<Badge variant="destructive">Suspended</Badge>
<Badge variant="warning">Pending</Badge>Variants: default · primary · destructive · outline · vip · success · warning
Avatar
import { Avatar, AvatarImage, AvatarFallback } from '@casinokit/ui';
<Avatar>
<AvatarImage src="https://..." alt="player avatar" />
<AvatarFallback>PL</AvatarFallback>
</Avatar>Typography
import { Typography } from '@casinokit/ui';
<Typography variant="h1">Welcome to the Lobby</Typography>
<Typography variant="lead">Over 3,000 games available</Typography>
<Typography variant="muted">Terms and conditions apply</Typography>
<Typography variant="code">0xabc...1234</Typography>Variants: display · title · h1 · h2 · h3 · h4 · p · lead · large · small · label · muted · blockquote · code
Table
import {
Table, TableHeader, TableBody, TableRow,
TableHead, TableCell, TableCaption,
} from '@casinokit/ui';
<Table>
<TableHeader>
<TableRow>
<TableHead>Game</TableHead>
<TableHead>Bet</TableHead>
<TableHead>Result</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell>Sweet Bonanza</TableCell>
<TableCell>$5.00</TableCell>
<TableCell>$12.50</TableCell>
</TableRow>
</TableBody>
</Table>Layout
Navbar
import { Navbar, NavbarLeft, NavbarCenter, NavbarRight } from '@casinokit/ui';
<Navbar variant="bordered" size="md">
<NavbarLeft>
<img src="/logo.svg" alt="Casino" className="h-8" />
</NavbarLeft>
<NavbarCenter>
{/* nav links */}
</NavbarCenter>
<NavbarRight>
<Button size="sm">Deposit</Button>
</NavbarRight>
</Navbar>Navbar supports default, transparent, bordered, and floating variants, with sm, md, and lg sizes. NavbarAuthDefault accepts custom trigger and menuHeader content, while NavbarGuestDefault accepts custom button text and variants.
Sidebar & SidebarAuthWidget
A deeply composable layout component that handles state, collapsing animations, and nested tooltips automatically via React Context.
Features:
- Seamless collapsing (
w-64tow-16) - Smart floating tooltips for icons when collapsed
- Responsive
SidebarTriggerwith Menu/X state icons - A completely unopinionated
SidebarAuthWidgetthat uses Render Props for ultimate design freedom.
Place SidebarTrigger anywhere inside SidebarProvider, such as in a navbar. It collapses the sidebar on desktop and opens or closes the off-canvas sidebar on mobile. Keep it outside Sidebar so it remains available when the mobile sidebar is closed.
import {
SidebarProvider, SidebarTrigger, Sidebar, SidebarHeader, SidebarContent, SidebarFooter, SidebarItem,
SidebarAuthWidget, SidebarAuthDefault, SidebarGuestDefault
} from '@casinokit/ui';
import { Dices, Trophy, Wallet } from 'lucide-react';
<SidebarProvider>
<SidebarTrigger className="m-2" />
<Sidebar>
<SidebarHeader>
<img src="/logo.svg" alt="Casino" className="h-7" />
</SidebarHeader>
{/*
The SidebarAuthWidget uses "Render Props" for its auth/guest slots.
It automatically injects the `collapsed` boolean into your custom design
so you know when to hide/show text!
*/}
<SidebarAuthWidget
isLoggedIn={true}
// --- Option 1: Use the Beautiful Default UI ---
auth={(collapsed) => (
<SidebarAuthDefault
collapsed={collapsed}
username="HighRoller99"
balance="$12,450.00"
onDepositClick={() => console.log('Deposit')}
/>
)}
guest={(collapsed) => (
<SidebarGuestDefault
collapsed={collapsed}
onLoginClick={() => console.log('Login')}
/>
)}
/*
// --- Option 2: Pass a completely custom design! ---
auth={(collapsed) => (
<div className="flex items-center gap-2">
<MyCustomAvatar />
{!collapsed && <span>My Custom Profile Text</span>}
</div>
)}
*/
/>
<SidebarContent>
<SidebarItem icon={<Dices size={18} />} active>Lobby</SidebarItem>
<SidebarItem icon={<Trophy size={18} />}>Promotions</SidebarItem>
<SidebarItem icon={<Wallet size={18} />}>Wallet</SidebarItem>
</SidebarContent>
<SidebarFooter>
{/* Additional footer items */}
</SidebarFooter>
</Sidebar>
</SidebarProvider>SidebarProvider supports controlled collapsed and mobileOpen state with change callbacks. Sidebar supports left or right placement, default, bordered, or floating variants, custom width, collapsedWidth, and overlayClassName.
Footer
import { Footer, FooterTop, FooterColumn, FooterTitle, FooterLink, FooterBottom } from '@casinokit/ui';
<Footer variant="bordered" containerWidth="6xl">
<FooterTop columns={3} gap="md">
<FooterColumn>
<FooterTitle>Casino</FooterTitle>
<FooterLink href="/games">Games</FooterLink>
</FooterColumn>
</FooterTop>
<FooterBottom>© 2026 CasinoKit</FooterBottom>
</Footer>Footer supports default, bordered, and minimal variants. FooterTop supports one to six responsive columns and sm, md, or lg gaps. All layout primitives retain className, native props, and refs.
Hero / HeroBadge
import { Hero, HeroBadge, Button } from '@casinokit/ui';
<Hero
title="Find your next favorite game"
subtitle="Explore slots, live casino, and exclusive rewards."
bgImage="/images/home-hero.jpg"
badges={<HeroBadge color="primary">Featured</HeroBadge>}
>
<Button>Explore games</Button>
<Button variant="outline">View promotions</Button>
</Hero>Hero supports default, compact, and centered variants, sm through full content widths, start, center, and end content positions, optional background images, custom background, overlay, and content slots, custom actions, background position/size, title variants, and dedicated class hooks. HeroBadge supports primary, emerald, red, amber, pink, and zinc colors.
Games
GameCard
import { GameCard } from '@casinokit/ui';
<GameCard
variant="portrait" // "portrait" (3:4) | "landscape" (16:9) | "square" (1:1)
thumbnail="/games/gates-of-olympus.jpg"
title="Gates of Olympus"
provider="Pragmatic Play"
badge="Hot"
onPlay={() => launchRealMoneyGame()}
onDemo={() => launchFunPlayGame()}
/>Props (API Level):
variant: The aspect ratio of the card image. Options:"portrait" | "landscape" | "square". Default is"portrait".cardVariant: Visual treatment:"default" | "featured" | "compact".thumbnail: The source URL for the game poster image.title: The name of the game (displayed below the image).provider: The name of the studio/provider (displayed below the title).badge: (Optional) Text or custom React content for a small badge on the top right.disabled/locked: Optional card states that disable interaction or show a lock overlay.disabledContent/lockedContent: Optional React content shown for availability or eligibility messages. These replace the default actions.image,overlay,footer: Optional custom slots that replace the default card content.playLabel/demoLabel: Accessible labels for the default action buttons.onPlay: Callback fired when the user clicks the primary circular Real Play button.onDemo: (Optional) Callback fired when the user clicks the secondary Fun Play text link. If omitted, the link is not rendered (useful for Live Casino games that do not have a demo mode).
GameGrid / GameSection
import { GameGrid, GameSection, GameCard } from '@casinokit/ui';
import { Flame } from 'lucide-react';
<GameSection
title="Popular Games"
icon={<Flame size={18} />}
onAction={() => navigate('/games')}
>
<GameGrid size="md">
{games.map((game) => (
<GameCard key={game.id} {...game} />
))}
</GameGrid>
</GameSection>Grid sizes: sm (120px min) · md (140px min) · lg (180px min)
GameGrid also supports minCardWidth, explicit columns, gap, and normal className/style overrides. GameSection supports custom header, actions, and empty content, plus headingLevel, headerClassName, titleClassName, and contentClassName.
GamePlayer
import { GamePlayer } from '@casinokit/ui';
{/* Inline (16:9 iframe block) */}
<GamePlayer
src="https://provider.com/launch/sweet-bonanza"
title="Sweet Bonanza"
/>
{/* Fullscreen overlay */}
<GamePlayer
src="https://provider.com/launch/sweet-bonanza"
title="Sweet Bonanza"
mode="fullscreen"
onExitFullscreen={() => setFullscreen(false)}
/>For custom player layouts, use aspectRatio, loading, toolbar, and iframeProps to control the inline frame, loading state, fullscreen toolbar, and provider iframe attributes.
Marketing
PromotionCard
A highly flexible, responsive card built for displaying marketing banners and bonuses.
Features:
- Responsive sizing via the
sizeprop (sm,md,lg,xl) - Smart text positioning (
bottom-left,center,top-right, etc.) - Auto-adapting background gradients that flip based on text position to ensure readability.
- Visual appearances:
default,featured, andminimal - Availability states:
active,disabled,expired, andclaimed - Custom
image,content,badge,overlay,footer, anddisabledContentslots
import { PromotionCard } from '@casinokit/ui';
<PromotionCard
size="lg" // "sm" | "md" | "lg" | "xl"
textPosition="center" // "bottom-left" | "bottom-right" | "top-left" | "top-right" | "center"
thumbnail="/games/gates-of-olympus.jpg"
title="200% Welcome Bonus"
description="On your first deposit, up to $1,000"
actionText="Claim Now"
onAction={() => navigate('/deposit')}
/>Carousel
A powerful wrapper around embla-carousel-react, designed for native-feeling swipe gestures and infinite loops.
Features:
- Native scrolling physics & Touch Support
- Built-in Mobile UX fixes (automatically hides
CarouselPreviousandCarouselNextbuttons on mobile devices so horizontal swipe events aren't hijacked by the browser). - Infinite looping via
opts={{ loop: true }} - Support for official plugins like Autoplay
import { Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext } from '@casinokit/ui';
import Autoplay from "embla-carousel-autoplay";
// Basic setup
<Carousel opts={{ loop: true, align: "start" }}>
<CarouselContent>
{/* Use basis classes to show multiple items on screen at once */}
<CarouselItem className="basis-1/2">
<PromotionCard title="Slide 1" description="..." />
</CarouselItem>
<CarouselItem className="basis-1/2">
<PromotionCard title="Slide 2" description="..." />
</CarouselItem>
</CarouselContent>
<CarouselPrevious />
<CarouselNext />
<CarouselDots />
</Carousel>
// With Autoplay plugin
const plugin = React.useRef(Autoplay({ delay: 3500, stopOnInteraction: true }));
<Carousel plugins={[plugin.current]} onMouseEnter={plugin.current.stop} onMouseLeave={() => plugin.current.play()}>
<CarouselContent>...</CarouselContent>
</Carousel>CarouselDots provides accessible pagination, and useCarousel is available for custom controls. Install embla-carousel-autoplay when using the autoplay plugin.
Authoring convention
When building new components inside this package, follow these rules:
Colors — always use ck-* tokens:
// ✅ correct
className="bg-ck-surface border-ck-border text-ck-fg"
// ❌ never use these (shadcn / undefined vars)
className="bg-card border-border text-foreground"Interactive states — always use Base UI data attributes:
// ✅ correct (Base UI emits these)
"data-[hover]:bg-white/10"
"data-[focus-visible]:ring-2 data-[focus-visible]:ring-ck-primary"
"data-[disabled]:opacity-50"
"data-[checked]:border-ck-primary"
// ❌ never use native pseudo-classes on Base UI components
"hover:bg-white/10" // works on plain HTML, not reliable on Base UI
"focus-visible:ring-2" // doesn't fire on Base UI componentsAnimations on Base UI popups:
// ✅ correct (Base UI's transition system)
"data-[starting-style]:opacity-0 data-[starting-style]:scale-95"
"data-[ending-style]:opacity-0 data-[ending-style]:scale-95"
// ❌ never (Radix/shadcn Tailwind animation plugin - different ecosystem)
"data-[state=open]:animate-in data-[state=closed]:animate-out"Prop conflicts with HTMLAttributes:
// ✅ Omit conflicting native events
interface MyProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSubmit'> {
onSubmit?: (data: MyData) => void
}Package exports
| Export | Contents |
|---|---|
| @casinokit/ui | All components + cn util |
