@keypix/ui
Version:
A premium React component library built with TypeScript, Tailwind CSS, and Atomic Design principles. The most comprehensive and beautiful UI library available.
518 lines (405 loc) โข 11.7 kB
Markdown
# ๐จ Keypix UI
> **A premium React component library built with TypeScript and Atomic Design principles. The most comprehensive and beautiful UI library available.**
[](https://badge.fury.io/js/keypix-ui)
[](https://bundlephobia.com/result?p=keypix-ui)
[](https://www.typescriptlang.org/)
[](LICENSE)
<div align="center">

**Lightweight โข Accessible โข Customizable โข TypeScript โข Zero Config**
[๐ Documentation](https://ui.keypix.uz/docs) โข [๐จ Live Demo](#live-demo) โข [๐ Quick Start](#quick-start) โข [๐ก Examples](#examples)
</div>
## โจ Features
- ๐ **Ultra Lightweight** - Only 13.47 KB gzipped
- ๐ฏ **Zero Configuration** - Works out of the box
- โฟ **Accessible** - WCAG 2.1 AA compliant
- ๐จ **Beautiful Design** - Modern, clean aesthetics
- ๐ง **Fully Customizable** - CSS variables & themes
- ๐ฑ **Responsive** - Mobile-first approach
- ๐ **Dark Mode** - Built-in theme switching
- โก **High Performance** - Optimized for speed
- ๐ **Type Safe** - Full TypeScript support
- ๐งฉ **Atomic Design** - Scalable component architecture
## ๐ฆ Installation
```bash
npm install keypix-ui
# or
yarn add keypix-ui
# or
pnpm add keypix-ui
```
## ๐ Quick Start
### 1. Install the library
```bash
npm install keypix-ui
```
### 2. Import and use components
```tsx
import { Button, Input, Card, ThemeProvider } from 'keypix-ui'
function App() {
return (
<ThemeProvider>
<div className="keypix-p-8">
<Card>
<CardHeader>
<CardTitle>Welcome to Keypix UI</CardTitle>
</CardHeader>
<CardContent>
<Input placeholder="Enter your name" />
<Button>Get Started</Button>
</CardContent>
</Card>
</div>
</ThemeProvider>
)
}
```
**That's it!** ๐ No configuration needed. Styles are automatically injected.
## ๐ฏ Auto-Styling
Keypix UI automatically applies global styles when imported, including:
```css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
font-family: 'Inter', sans-serif;
}
*:focus,
*:active {
outline: none;
}
html,
body {
height: 100%;
}
```
These styles provide a clean foundation for your application. The Inter font is automatically loaded from Google Fonts.
## ๐จ Live Demo
See all components in action with our interactive demo:
```bash
# Clone the repository
git clone https://github.com/keypix-tech/ui.git
cd keypix-ui
# Install dependencies
npm install
# Start the demo
npm run dev
```
Then open [http://localhost:5173](http://localhost:5173) in your browser to see the complete component showcase with:
- All button variants and states
- Form inputs with validation
- Badges and avatars
- Loading spinners
- Search bars and modals
- Data tables
- Theme switching (Light/Dark/System)
- Responsive design examples
## ๐จ Components
### Atoms
- [Button](./docs/components/button.md) - Versatile button with multiple variants
- [Input](./docs/components/input.md) - Form input with validation states
- [Badge](./docs/components/badge.md) - Status indicators and labels
- [Avatar](./docs/components/avatar.md) - User profile images
- [Spinner](./docs/components/spinner.md) - Loading indicators
### Molecules
- [SearchBar](./docs/components/search-bar.md) - Search input with actions
- [Alert](./docs/components/alert.md) - Notification messages
- [Modal](./docs/components/modal.md) - Overlay dialogs
### Organisms
- [Header](./docs/components/header.md) - Page navigation
- [DataTable](./docs/components/data-table.md) - Tabular data display
### Providers
- [ThemeProvider](./docs/components/theme-provider.md) - Theme management
## ๐ก Examples
### Basic Button Usage
```tsx
import { Button } from 'keypix-ui'
// Different variants
<Button variant="default">Default</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="destructive">Delete</Button>
<Button variant="outline">Outline</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="link">Link</Button>
// Different sizes
<Button size="sm">Small</Button>
<Button size="md">Medium</Button>
<Button size="lg">Large</Button>
// With loading state
<Button loading>Processing...</Button>
// With icons
<Button leftIcon={<DownloadIcon />}>Download</Button>
```
### Form with Validation
```tsx
import { Input, Button, Card } from 'keypix-ui'
function ContactForm() {
const [email, setEmail] = useState('')
const [error, setError] = useState('')
return (
<Card>
<CardHeader>
<CardTitle>Contact Us</CardTitle>
</CardHeader>
<CardContent>
<Input
type="email"
placeholder="Enter your email"
value={email}
onChange={(e) => setEmail(e.target.value)}
error={!!error}
helperText={error}
/>
<Button
onClick={handleSubmit}
loading={isSubmitting}
disabled={!email}
>
Send Message
</Button>
</CardContent>
</Card>
)
}
```
### Theme Switching
```tsx
import { ThemeProvider, useTheme, Button } from 'keypix-ui'
function ThemeToggle() {
const { theme, setTheme } = useTheme()
return (
<div className="keypix-flex keypix-gap-2">
<Button
variant={theme === 'light' ? 'default' : 'outline'}
onClick={() => setTheme('light')}
>
Light
</Button>
<Button
variant={theme === 'dark' ? 'default' : 'outline'}
onClick={() => setTheme('dark')}
>
Dark
</Button>
<Button
variant={theme === 'system' ? 'default' : 'outline'}
onClick={() => setTheme('system')}
>
System
</Button>
</div>
)
}
function App() {
return (
<ThemeProvider defaultTheme="system">
<ThemeToggle />
{/* Your app content */}
</ThemeProvider>
)
}
```
## ๐จ Customization
### CSS Variables
Keypix UI uses CSS variables for easy customization:
```css
:root {
--primary: 221.2 83.2% 53.3%;
--primary-foreground: 210 40% 98%;
--secondary: 210 40% 96%;
--secondary-foreground: 222.2 84% 4.9%;
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--border: 214.3 31.8% 91.4%;
--radius: 0.5rem;
}
.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
/* ... other dark theme variables */
}
```
### Custom Theme
```tsx
import { ThemeProvider } from 'keypix-ui'
function App() {
return (
<ThemeProvider
defaultTheme="dark"
storageKey="my-app-theme"
>
{/* Your app */}
</ThemeProvider>
)
}
```
### Component Styling
```tsx
// Using className prop
<Button className="keypix-bg-red-500 hover:keypix-bg-red-600">
Custom Button
</Button>
// Using CSS variables
<Button style={{ '--primary': '220 13% 91%' }}>
Custom Primary
</Button>
```
## ๐ฑ Responsive Design
All components are mobile-first and responsive:
```tsx
// Responsive grid
<div className="keypix-grid keypix-grid-cols-1 md:keypix-grid-cols-2 lg:keypix-grid-cols-3 keypix-gap-4">
<Card>Card 1</Card>
<Card>Card 2</Card>
<Card>Card 3</Card>
</div>
// Responsive spacing
<div className="keypix-p-4 md:keypix-p-6 lg:keypix-p-8">
Content with responsive padding
</div>
```
## โฟ Accessibility
Keypix UI is built with accessibility in mind:
- **WCAG 2.1 AA compliant**
- **Keyboard navigation** support
- **Screen reader** friendly
- **High contrast** mode support
- **Reduced motion** preferences
- **ARIA attributes** on all components
```tsx
// Accessible button with proper labels
<Button
aria-label="Download file"
aria-describedby="download-description"
>
Download
</Button>
<div id="download-description" className="keypix-sr-only">
Downloads the current file in PDF format
</div>
```
## ๐ง API Reference
### Button
```tsx
interface ButtonProps {
variant?: 'default' | 'secondary' | 'destructive' | 'outline' | 'ghost' | 'link' | 'success' | 'warning' | 'info'
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'icon'
loading?: boolean
loadingText?: string
leftIcon?: React.ReactNode
rightIcon?: React.ReactNode
fullWidth?: boolean
disabled?: boolean
ariaLabel?: string
ariaDescription?: string
ariaLive?: 'off' | 'polite' | 'assertive'
}
```
### Input
```tsx
interface InputProps {
label?: string
helperText?: string
error?: boolean
required?: boolean
leftIcon?: React.ReactNode
rightIcon?: React.ReactNode
// ... all standard input props
}
```
[๐ Full API Documentation](./docs/api.md)
## ๐งช Testing
```tsx
import { render, screen } from '@testing-library/react'
import { Button } from 'keypix-ui'
test('renders button with text', () => {
render(<Button>Click me</Button>)
expect(screen.getByRole('button', { name: /click me/i })).toBeInTheDocument()
})
test('handles click events', () => {
const handleClick = jest.fn()
render(<Button onClick={handleClick}>Click me</Button>)
fireEvent.click(screen.getByRole('button'))
expect(handleClick).toHaveBeenCalledTimes(1)
})
```
## ๐ Performance
- **Bundle Size**: 13.47 KB gzipped
- **Loading Time**: 264ms on slow 3G
- **Runtime**: 94ms on Snapdragon 410
- **Tree Shaking**: Fully supported
- **Code Splitting**: Automatic
## ๐ ๏ธ Development
### Prerequisites
- Node.js 18+
- npm/yarn/pnpm
### Setup
```bash
git clone https://github.com/keypix-tech/ui.git
cd keypix-ui
npm install
```
### Scripts
```bash
# Development
npm run dev # Start development server with demo
# Building
npm run build # Build library
npm run build:clean # Clean build
# Testing
npm run test # Run tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage report
# Quality
npm run lint # ESLint
npm run type-check # TypeScript check
npm run size # Bundle size analysis
```
### Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests
5. Submit a pull request
[๐ Contributing Guidelines](./CONTRIBUTING.md)
## ๐ Roadmap
- [ ] **More Components**
- [ ] DataGrid
- [ ] DatePicker
- [ ] MultiSelect
- [ ] FileUpload
- [ ] RichTextEditor
- [ ] **Enhanced Features**
- [ ] Animation library
- [ ] Form validation
- [ ] Internationalization
- [ ] Server-side rendering
- [ ] **Developer Experience**
- [ ] CLI tool
- [ ] VS Code extension
- [ ] Figma plugin
- [ ] Design tokens
- [ ] **Documentation**
- [ ] Interactive playground
- [ ] Video tutorials
- [ ] Migration guides
- [ ] Best practices
## ๐ค Community
- [๐ Documentation](https://ui.keypix.uz/docs)
- [๐จ Live Demo](#live-demo)
- [๐ Issues](https://github.com/keypix-tech/ui/issues)
- [๐ฌ Discussions](https://github.com/keypix-tech/ui/discussions)
- [๐ง Email](mailto:keypixteam@gmail.com)
## ๐ License
MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ Acknowledgments
- [Tailwind CSS](https://tailwindcss.com/) for the utility-first approach
- [shadcn/ui](https://ui.shadcn.com/) for inspiration
- [Radix UI](https://www.radix-ui.com/) for accessibility patterns
- [React](https://reactjs.org/) for the amazing framework
---
<div align="center">
**Made with โค๏ธ by [Keypix Team](https://keypix.uz)**
[Website](https://ui.keypix.uz) โข [GitHub](https://github.com/keypix-tech/ui) โข [Twitter](https://twitter.com/keypixtech)
</div>