React UI components for GameCP
npm install @gamecp/uiReact UI component library for GameCP. A collection of reusable, accessible, and customizable components built with React, TypeScript, and Tailwind CSS.
``bash`
npm install @gamecp/ui
- React 19+
- Tailwind CSS (configured in your project)
- react-icons
- framer-motion
- Next.js 15+ (for Link component)
`tsx
import { Button, Card, FormInput, Badge } from '@gamecp/ui';
function MyComponent() {
return (
name="email"
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
);
}
`
#### Button
Versatile button component with multiple variants and sizes.
`tsx`
Props:
- variant: 'primary' | 'secondary' | 'destructive' | 'ghost' | 'link' | 'outline'size
- : 'sm' | 'md' | 'lg'isLoading
- : booleanleftIcon
- , rightIcon: React.ReactNodefullWidth
- : boolean
#### Badge
Display status, categories, or labels.
`tsx`
Props:
- variant: 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info' | 'gray' | 'purple' | etc.size
- : 'sm' | 'md' | 'lg'customColors
- : { background, text, border }
#### Card
Flexible container component with header, content, and footer sections.
`tsx`
subtitle="Subtitle"
icon={IconComponent}
variant="default"
>
Card content
Variants:
- SimpleCard: Basic cardHeaderCard
- : Card with header sectionStatusCard
- : Card with status indicatorClickableCard
- : Interactive cardAccordionCard
- : Collapsible card
#### Link
Next.js Link wrapper with consistent styling.
`tsx`
Go to Dashboard
#### FormInput
Comprehensive form input supporting multiple types.
`tsx`
name="username"
type="text"
value={value}
onChange={handleChange}
required
error={errors.username}
description="Enter your username"
/>
Supported Types:
- text, email, password, number, tel, url
- checkbox, textarea, color
Features:
- Icon support (left/right)
- Password visibility toggle
- Copy to clipboard
- Clear button
- Loading states
- Error handling
#### Switch
Toggle switch component.
`tsx`
onChange={setEnabled}
label="Enable feature"
description="Turn this on to enable the feature"
/>
#### Modal
Accessible modal dialog with animations.
`tsx`
onClose={handleClose}
title="Modal Title"
size="md"
>
Modal content
Props:
- size: 'sm' | 'md' | 'lg' | 'xl' | 'full'blocking
- : boolean (prevents closing)variant
- : 'default' | 'plain'fullScreen
- : boolean
#### LoadingSpinner
Animated loading indicator.
`tsx`
#### PageHeader
Consistent page header with title, subtitle, and actions.
`tsx`
title="Page Title"
subtitle="Page description"
rightContent={}
/>
#### FormSection
Organize form fields into logical sections.
`tsx`
description="Manage your account preferences"
>
#### Grid & GridItem
Responsive grid layout system.
`tsx`
All components use Tailwind CSS utility classes and expect your project to have Tailwind configured. The components use semantic color tokens like:
- primary, secondary, destructiveforeground
- , background, mutedborder
- , ring, success, error
Make sure these are defined in your Tailwind theme.
All components are fully typed with TypeScript. Import types as needed:
`tsx`
import type { ButtonProps, BadgeVariant } from '@gamecp/ui';
`bashInstall dependencies
npm install
MIT